开发者

ASP.NET MVC, Loading forms via PartialViews

开发者 https://www.devze.com 2023-01-26 22:33 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消