ASP.NET MVC 2 RC client side validation not working

后端 未结 5 611
时光说笑
时光说笑 2021-01-19 01:58

I can\'t seem to get any client side validation working on a MVC 2 RC app.

My model has the following:

public class ExampleModel
{
    [Required(Erro         


        
5条回答
  •  不要未来只要你来
    2021-01-19 02:50

    The default (and only supported by Microsoft) validation system in the ASP.NET MVC 2 Release Candidate does not use jQuery Validate. Instead, it uses a new validation system that exists entirely in MicrosoftMvcValidation.js (though you do also need to include MicrosoftAjax.js).

    If you want to use the jQuery Validate library, it is included as part of the ASP.NET MVC Futures project (available here), which is a separate download, and has its own adapter script file.

    Also, regarding the Html.ValidationSummary() helper, I believe it needs to be included inside the form if you want it to have the new client-side functionality. It will still work if it's outside of the form, but it will only work server-side.

提交回复
热议问题