how to populate a KendUI Window

萝らか妹 提交于 2020-01-06 19:41:40

问题


I am new to Kendo UI. I would like to be able to display a popup with the results from my controller.

My example is very simple. I have this data on my page.

Some text    [Create]

When I click on [Create], a call in made to my controller. The controller will create a PDF file. Next, I would like to be able to display the pdf in a KendoUI Window.

I am getting hung up on how to pass info back to page so the KendoUi Window is aware of the PDF file name to display.

Thanks in advance for your tips.

Steve

MVC 4

KendoUI 2012.2.270


回答1:


There are two basic approaches:

  1. You create the window when page is loaded and have a function for changing the content and make it visible.
  2. You create the window each time.

Assuming that you for 1. Then you have an HTML that is something like this

<div id="popup_window">
</div>
<a href="#" id="show">Create PDF</a>

Then you define the window and the click bind for triggering the open as:

$("#popup_window").kendoWindow({
    title    :"PDF document",
    visible  :false
});

$("#show").click(function () {
    $("#popup_window").html("<object id='pdf' data='doc.pdf' type='application/pdf'/>");
    $("#popup_window").data("kendoWindow").open();
});

Where I create a kendoWindow but set it's visibility to not visible. Then I bind a function to the click on the Create PDF message that sets the content to an HTML object where data attribute is the pdf document and then open by invoking kendoWindow open method.



来源:https://stackoverflow.com/questions/13458150/how-to-populate-a-kendui-window

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!