10

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.

Lars Höppner
  • 18,252
  • 2
  • 45
  • 73
Greg Gum
  • 33,478
  • 39
  • 162
  • 233

1 Answers1

22

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.

Lars Höppner
  • 18,252
  • 2
  • 45
  • 73
  • 1
    I have some trouble with this solution. I'm loading a PartialView with other kendo widgets into the window and I'm getting JavaScript errors and the widgets are not displayed correctly. – Sven May 06 '16 at 08:27