I am using KendoUI for MVC, trying to open a Kendo-UI-Window that loads its content like this:
.LoadContentFrom("Edit", "CustomerContact")
.Events(events => events.Open("centerWindow"))
When the Edit.cshtml view uses my _DialogLayout.cshtml it will not load. When the Edit.cshtml view has Layout = null the window loads just fine.
The JavaScript error that I am getting when clicking to open the dialog is: Uncaught TypeError: Cannot read property 'open' of undefined
Here is my javascript: .Events(events => events.Open("centerWindow"))
<script>
$(document).ready(function () {
$("#btnNewContact")
.bind("click", function () {
$("#windowContact").data("kendoWindow").open();
});
});
function centerWindow(e) {
e.sender.center();
}
</script>
Why would the error happen when Edit.cshtml is using the _DialogLayout.cshtml view which is a stripped down verison of _Layout.cshtml. It works completely fine when I create a view with no Layout.
Aucun commentaire:
Enregistrer un commentaire