How to provide warnings during validation in ASP.NET MVC?

后端 未结 5 2024
我寻月下人不归
我寻月下人不归 2020-12-12 20:52

Sometimes user input is not strictly invalid but can be considered problematic.

For example:

  • A user enters a long sentence in a single-line Name<
5条回答
  •  误落风尘
    2020-12-12 21:07

    You could use the depends function of jquery validation to simplify your life.

    Ex.

    @Html.LabelFor(m => m.UserName)
    @Html.TextBoxFor(m => m.UserName)
    @Html.ValidationMessageFor(m => m.UserName)
    
    
    
    
    
    

提交回复
热议问题