ASP.NET MVC 2 RC client side validation not working

后端 未结 5 598
时光说笑
时光说笑 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:48

    Are you sure you included the correct JS files? Because in Phill Haack's post it has MicrosoftMvcJQueryValidation.js attached instead of MicrosoftMvcValidation.js.

    He also sets the ClientValidationFunction property in the view :

    <% ViewContext.FormContext.ClientValidationFunction 
    = "EnableClientValidation"; %>
    

    Though that was not RC, but Beta.

提交回复
热议问题