简体   繁体   English

如何设置Kendo窗口的内容?

[英]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: 我可以用这个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. 换句话说,“data”参数将是错误窗口中显示的文本。

Use kendoWindow.content(data) , eg: 使用kendoWindow.content(data) ,例如:

$("#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 . 如果您希望它显示在窗口内的某个元素中,您可以在kendoWindow.element搜索它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM