• Why is my ASP.NET MVC data annotation validation is not working?

    asked on 13th Jul, 2017 by Ahtesham - Category : MVC Q & A
    by Imran on 13th Jul, 2017
    Data annotation validation will not fire when you use model binder as you are creating the objects manually using new keyword. Only and only if the objects come autommapped , i mean get automatically filled in the MVC action method input parameter then only ModelState validation will execute. For firing validation model binder code you need to manually invoke the validation. I would suggest you to watch this C# data annotation which explains how to use data annotation with simple C# video https://www.youtube.com/watch?v=Gft64NdIx3k So in the action method you need to invoke the "tryValidate" method and perform validations. Thanks
    1 Answers. Know better answer... Answer Now

We are on Social

Follow us on Twitter

See Hashtag #Questpond on Twitter
to see what others have posted.

Like us on Facebook

See Hashtag #Questpond on Facebook
to see what others have posted.

Follow us on G+

See Hashtag #Questpond on Google Plus
to see what others have posted.

Follow us on Linkedin

See Hashtag #Questpond on Linkedin
to see what others have posted.