asp.net - 剑道 UI MVC 4 : Form Validation inside a Window does not fire

标签 asp.net asp.net-mvc kendo-ui

使用 ASP.NET MVC 4,我声明了一个窗口,其中通过 LoadContentFrom() 加载了内部内容(表单):

@(Html.Kendo().Window()
      .Name("windowAttachClient")
      .Title("Attach Client")
      .LoadContentFrom("MyAction", "ManageUser", new {a= Model.a})
      )

窗口显示正常,内容表单加载并工作,但客户端验证不起作用。注意我在 Web.Config 中设置了验证:

<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />

如果我将内容从外部操作移动并将其在页面上硬编码到窗口中,则验证有效。

有没有办法让一个窗口(在由 LoadContentFrom() 加载的内容中有一个表单)与客户端验证一起使用?

最佳答案

我猜测这是因为内容被注入(inject)到页面中,您需要处理加载事件,然后告诉验证器在新表单加载到 dom 中后解析新表单。另一个快速选项是将窗口切换到 iframe 模式。

    .Iframe(true)

关于asp.net - 剑道 UI MVC 4 : Form Validation inside a Window does not fire,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15773938/

相关文章:

c# - System.Web.Http.AuthorizeAttribute 无法识别自定义角色提供者

javascript - 如何从 ".js"文件运行 url?

asp.net-mvc - 条件数据注释

javascript - 将 javascript datetime 转换为 C# 时出现解析错误

kendo-ui - 剑道UI : Place Grid Summary Values in Footer

c# - Gridview 被调用两次

c# - 从数据库中获取位值并显示在 GridView 的 CheckBox 中

asp.net - 将 Azure 网站配置为始终解析为自定义域

c# - 将 Viewmodel 对象发送到 ASP .Net MVC 中的 Razor View

javascript - 复选框问题