ASP.NET MVC 2 RC client side validation not working

后端 未结 5 567
时光说笑
时光说笑 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条回答
  •  -上瘾入骨i
    2021-01-19 02:40

    You have to include MicrosoftMvcJQueryValidation.js file :

    Check this: Where is the right version of MicrosoftMvcJQueryValidation.js for MVC 2 beta 2?

    Next just put Html.EnableClientValidation(); somewhere in the View page. It must be before the first form you want to client-side validate. I prefer Site.Master page.

    Working on ASP.NET MVC 2 RC.

提交回复
热议问题