@Ajax.ActionLink("Edit", "LoadEditSkill", new { id = item.Id }, new AjaxOptions() { UpdateTargetId = "editSkillDialog" }, new { @class = "editSkill" })
视图很好.它将数据发回服务器,但它不会验证.
解决方法:
非常感谢Joe Tuskan指出了正确的方向.
我通过在我的调用中添加一个OnSuccess订阅者来修复此问题:
@Ajax.ActionLink("Edit", "LoadEditSkill", new { id = item.Id }, new AjaxOptions() { UpdateTargetId = "editSkillDialog", OnSuccess= "onSuccess" }, new { @class = "editSkill" })
并添加调用解析(),如解释here:
var OnSuccess= function () { // enable unobtrusive validation for the contents // that was injected into the node $.validator.unobtrusive.parse($("#editSkillDialog")); };