The following code snippet demonstrates how RadGrid can be integrated with the ASP.NET AJAX framework. The example features the following components:
RadGrid - displays the stock quote data.
ASP.NET AJAX UpdatePanel -- wraps the grid control and performs the Ajax requests.
ASP.NET AJAX UpdateProgress -- responsible for the visual indication on the client-side of an ongoing Ajax request.
ASP.NET AJAX Timer -- triggers the Ajax requests for data refresh on a regular interval.
The grid is bound via an ObjectDataSource control that returns a dataset with the respective quote
data. The ObjectDataSource implementation internally uses WebService calls to handle the data retrieval.
When the WebService is called for the first time it establishes a connection to a website
(finance.yahoo.com) and gets some real-world data that will be used as a starting point for the sample
application. The quote data is then persisted locally in an xml file for later use and a resultant dataset
is generated from the same xml file. For consequent calls to the WebService (essentially triggered by the
timer component on the client-side) no data is downloaded from the Internet but the data from the xml is
modified locally to simulate stock quote rate changes; then it is persisted again in the same xml file
and a resultant dataset is returned to the ObjectDataSource instance.
The example can be easily extended to use real data by supplying a different DataSet in the StockQuoteService.GetStockQuotes(...) WebService