I have this window:
@(Html.Kendo().Window()
.Name("errorWindow")
.Title("")
.Content(@<text>
//Put text here
</text>)
.Draggable() //Enable dragging of the window
.Resizable() //Enable resizing of the window
.Modal(true)
.Visible(false)
)
which is converted to this on the client:
jQuery(function(){jQuery("#errorWindow").kendoWindow({"modal":true,"iframe":false,"draggable":true,"pinned":false,"title":"","resizable":true,"content":null,"actions":["Close"]});});
Which I can call with this JScript:
function onAjaxFailure(data) {
var window = $("#errorWindow").data("kendoWindow");
window.center().open();
}
But how do I put the text in the window? In other words, the "data" parameter will be the text to be shown in the error windows.
You can do it with setOptions api method, something like: // Setting some options wnd. setOptions({ title: "dynamic title", width: "60%" }); First initialize your window with your code and on some events (button click may be), use window object to set its options.
I used Kendo Window Activate event to center the window. If you are using Kendo Grid inside Kendo Window then you have to make sure that centerKendoWindow() dose not fire before the data is bound to the grid. if this is the case then you can use Kendo Grid DataBound event to center the window.
The Window is part of Kendo UI for jQuery, a professional grade UI library with 110+ components for building modern and feature-rich applications.
Use kendoWindow.content(data)
, e.g.:
$("#dialog").kendoWindow({
modal: true,
visible: false,
});
setTimeout(function () {
var kendoWindow = $("#dialog").data("kendoWindow");
kendoWindow.content("show this");
kendoWindow.center().open();
}, 2000);
(demo)
If you want it to show in a certain element inside the window, you can search for it in kendoWindow.element
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With