问题
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