Monthly Archives: May 2011

Server-side “PageIndexChanging” event in UltraWebGrid

When Infragistics UltraWebGrid is not in LoadOnDemand mode, you need to rebind the grid to the data source in PageIndexChanged event for paging to work. What’s neat – before the rebind, grid is still on the old page, effectively giving you “BeforePageIndexChanged” or “PageIndexChanging” event in server-side code:

Protected Sub xuwgGrid_PageIndexChanged(sender As Object, e As UltraWebGrid.PageEventArgs) Handles xuwgGrid.PageIndexChanged

   'Page hasn't changed yet, collect data from the old page
   'Or cancel the rebind and remain on the old page

   'rebinding the grid to the datasource

   'New page is in effect

End Sub

Affecting page during WebDataGrid AJAX calls

When Infragistics WebDataGrid perform AJAX operations such as sorting and paging – it sends grid data directly to page’s DOM. But it also allows you to send your own custom data via server-side GridResponse object and its client-side counterpart. This feature allows you to establish effective link between server and client to perform custom operations otherwise available only during full postback or partial postback via update panel. There’re multiple cases where this can be used, let’s take a look at 3 most common:

  • Updating a related control with server-side generated data
  • Running a server-side generated JavaScript
  • Handling server-side errors, for example Session timeout

Continue reading →