Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set the content of a Kendo window?

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.

like image 640
Greg Gum Avatar asked Jan 08 '14 23:01

Greg Gum


People also ask

How do I change the dynamic title of a kendo window?

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.

How do you center a kendo window?

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.

What is Kendo 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.


1 Answers

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.

like image 197
Lars Höppner Avatar answered Oct 08 '22 06:10

Lars Höppner