I have a radgrid which I am binding in the server side using the needdatasource event. After the initial bind, I need to refresh the grid once every 10 seconds. I need to refresh the grid only if the data has changed since the previous bind.
I have these lines of code in my javascript.
This fires up the need datasource event of the grid. Is there a way I can bind the grid conditionally in the needdatasource event ?
If the data hasn't changed then I want to skip the refreshing of the grid and retain the previously bound content. Following conditional binding of the grid throws error in some of the GridTemplateBound columns.
I know that I can check if the data has changed by making a wcf call from client side. I really wanted to avoid making multiple calls to get the data/ check for data.
I have these lines of code in my javascript.
window.setInterval("fetchrealtime()", 10000); function fetchrealtime() { StopTimer(); var masterTable = $find("<%= InquiryGrid.ClientID %>").get_masterTableView(); masterTable.fireCommand("RebindGrid"); }This fires up the need datasource event of the grid. Is there a way I can bind the grid conditionally in the needdatasource event ?
If the data hasn't changed then I want to skip the refreshing of the grid and retain the previously bound content. Following conditional binding of the grid throws error in some of the GridTemplateBound columns.
protected void InquiryGrid_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) { InquirySearchOutput results = inquirySvc.GetInquiryResults(); List<InquiryGridView> gridResults = results.gridResults; if(results.hasDelta == true) { InquiryGrid.VirtualItemCount = results.recordCount; InquiryGrid.DataSource = gridResults; } }I know that I can check if the data has changed by making a wcf call from client side. I really wanted to avoid making multiple calls to get the data/ check for data.