[英]Load a Telerik ASP.NET Ajax RadGrid into a Modal Popup and Refresh Data Over Ajax without Page Refresh
I have an application which currently implements a dynamically created RadGrid. 我有一个当前实现动态创建的 RadGrid的应用程序。 The grid is generated by reading the columns and datatypes from a specific SQL Server View.
通过从特定的SQL Server视图读取列和数据类型来生成网格。 We have many of these views which is why we use Dynamic creation.
我们有许多这样的视图,这就是为什么我们使用动态创建。
Every time the user interacts with a grid control (eg filter/paging control), the entire page is refreshed. 每次用户与网格控件(例如,过滤器/分页控件)进行交互时,都会刷新整个页面。 The RadGrid is recreated from scratch in the
Page_PreInit
method and populated with the updated data. 在
Page_PreInit
方法中从头开始重新创建Page_PreInit
并使用更新的数据填充。 This is a very poor user experience and also draining on server resources. 这是非常差的用户体验,并且还会消耗服务器资源。
I'm trawling through the Telerik documentation and cannot find a clear example of what I'm trying to achieve. 我正在浏览Telerik文档,但是找不到我想要实现的清晰示例。 I'd like to know if it's possible to achieve the following requirements:
我想知道是否有可能达到以下要求:
POST
request to the server - this will create the initial dynamic grid and return HTML
contenttype. POST
请求检索Modal弹出窗口的内容-这将创建初始动态网格并返回HTML
contenttype。 Can this use case be achieved with Telerik UI for ASP.NET Ajax? 可以使用用于ASP.NET Ajax的Telerik UI来实现此用例吗?
You can, here is how to open a RadWindow: http://docs.telerik.com/devtools/aspnet-ajax/controls/window/getting-started/opening-windows . 您可以通过以下方法打开RadWindow: http ://docs.telerik.com/devtools/aspnet-ajax/controls/window/getting-started/opening-windows。 Basically, call its show() client-side method.
基本上,调用其show()客户端方法。
The easiest way to do this is to have an aspx page that will render your grid and open it in the RadWindow (see the NavigateUrl property and the setUrl() client-side method, and the first argument to radopen() or open()). 最简单的方法是拥有一个aspx页面,该页面将呈现您的网格并在RadWindow中打开它(请参见NavigateUrl属性和setUrl()客户端方法,以及radopen()或open()的第一个参数) )。 RadWindow will generate a GET request for that page.
RadWindow将为该页面生成一个GET请求。
Option 2: Use the OnClientShow event of the RadWindow to generate your POST (eg, via the __doPostBack() MS AJAX function) and use the ContentTemplate of the RadWindow. 选项2:使用RadWindow的OnClientShow事件生成POST(例如,通过__doPostBack()MS AJAX函数)并使用RadWindow的ContentTemplate。 Examine the following article to see how to use AJAX with it: http://docs.telerik.com/devtools/aspnet-ajax/controls/window/how-to/how-to-use-radwindow-with-ajax .
请检查以下文章,以了解如何将AJAX与之配合使用: http : //docs.telerik.com/devtools/aspnet-ajax/controls/window/how-to/how-to-use-radwindow-with-ajax 。
Hint: Generally postbacks are used to fetch the data. 提示:通常,回发用于获取数据。 If you want less than that, use client-side binding for your grid: http://demos.telerik.com/aspnet-ajax/grid/examples/data-binding/client-side/client-data-source-binding/defaultcs.aspx
如果您不希望这样做,请对网格使用客户端绑定: http : //demos.telerik.com/aspnet-ajax/grid/examples/data-binding/client-side/client-data-source-binding/ defaultcs.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.