Kendo UI MVC 4: Form Validation inside a Window does not fire

老子叫甜甜 提交于 2019-12-24 05:54:17

问题


Using ASP.NET MVC 4 I have a window declared with the inner contents (a form) loaded via LoadContentFrom() :

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

The window appears fine and the contents form loads and works, but the client side Validation does not work. Note I have validation set in the Web.Config:

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

If I move the contents from the external action and hard code them on the page into the Window, then validation works.

Is there a way to have a window , that has a form in the contents loaded by LoadContentFrom(), work with client side validation?


回答1:


I am guessing this is because the content is being injected into the page, you would need to handle the load event and then tell the validator to parse the new form once it is loaded into the dom. Another quick option would be to switch the window to iframe mode.

    .Iframe(true)


来源:https://stackoverflow.com/questions/15773938/kendo-ui-mvc-4-form-validation-inside-a-window-does-not-fire

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