Data Annotations / Validation not working for partial views

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 00:54:53

Just Include JS files i.e Jquery Unobtrusive js file in your Partial View also then it work fine ,some times this problem comes in partial view in asp.net mvc.

Just include this js file in your Partial View also :

<script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>

------------------OR try this in Partial View--------------------------

$.validator.unobtrusive.parse($("form"));

try this if you are appending form in html

var formid = $("#frmAddProduct");
formid.unbind();
formid.data("validator", null);
$.validator.unobtrusive.parse($("#frmAddProduct"));

OR use in partial view on document ready

$.validator.unobtrusive.parse($("form"));
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!