解决方法启用的意见通过AJAX动态加载的Asp.Net MVC3表单验证表单、解决方法、加载、意见

2023-09-10 17:41:50 作者:抑郁症、想你

这是出现这种情况的人谁通过AJAX加载的局部视图一个非常常见的错误,这种观点与DataAnnotation验证的模型。当u加载查看验证停止工作。

如何解决呢?

解决方案

  $。获得(URL,函数()
{
    $ .validator.unobtrusive.parse(#形式-ID);
});
 

mvc ajax定时刷新数据库,通过Ajax.ActionLink 在ASP.NET MVC5中实现无刷新加载操作方法...

That's a very common bug that happens to people who load a partial view via ajax and that view has a model with DataAnnotation validators. When u load the View the validation stop working.

How to fix that?

解决方案

$.get("url", function()
{
    $.validator.unobtrusive.parse("#form-id");
});