MVC 4 client side validation not working

后端 未结 21 1372
情话喂你
情话喂你 2020-12-02 14:00

Can anyone tell me why client side validation is not working in my MVC 4 application.

_layout.schtml

@Scripts.Render("~/bundles/jquery")
@R         


        
21条回答
  •  天涯浪人
    2020-12-02 14:37

    The reason that the validation data-* attributes aren't showing in the rendered html for your input could be that there is no form context. The FormContext is created automatically when you create a form using @using(Html.BeginForm(...)) { ... }.

    If you use a regular html tag for your form, you won't get client-side validation.

提交回复
热议问题