I have a strongly type View in an ASP.NET MVC2 application in which i load a dropdownlist after its parent is selected using jquery ajax.The issue i am facing is that after the dropdownlist gets loaded the validation of the View stops working.
I am using data-annotations for validating the Views?
I have a strongly type View in an ASP.NET MVC2 application in which i
Share
After receiving the data from the Ajax call and then subsequently replacing the Dom element, you need to re-parse the document with jquery unobtrusive validation like so:
obviously replacing dropdownId with the actual Id of your dropdown. if you’re still having issues with other validation on the page, instead of parsing the dropdown, parse the entire document holder, e.g. say you have everything in a div with the id of main, you’d do: