ASP.NET MVC, Loading forms via PartialViews
I am developing an application using ASP.Net MVC and jQuery. Depending on users action, I load partial views into the page using jQuery's $.ajax method.
The problem, I am experiencing, is related to a particular partial view that contains a form, in which the client side validation is enabled. It do开发者_如何转开发es seem like the JavaScript code generated in this partial view is not being executed, hence the client validation is not working.
Does anybody have a solution for this issue?
Thanks!
Zen
You might need to put all scripts contained in this partial into a separate function. Then in the success
callback of you AJAX request simply call this function: it should attach validation to the newly modified DOM.
精彩评论