Search code examples
infragisticsultrawebgrid

How do you force Infragistics UltraWebGrid to databind if you handle the InitializeDataSource event?


I am using Infragistics UltraWebGrid. I've handled its InitializeDataSource event with a function that fills the grid's DataSource property. Great. That works. When the grid determines that it needs data it goes and gets it.

My issue is that there are times where, because of actions taken on the page, I need to go back to storage and get new data. When I do this supplying the data I want to use to the DataSource property and then calling DataBind nothing happens. The grid does not bind itself to its DataSource.

Is there an incantation of code that will force UltraWebGrid to bind to its DataSource while still handling the InitializeDataSource event?


Solution

  • Thanks for the suggestions. I ended up find the solution (with a little help from a co-worker). Here is the code (sorry for the VB):

    grid.DataSource = Nothing
    grid.DataBind()
    grid.Clear()
    grid.DataSource = theNewDataSource
    grid.DataBind()
    

    Apparently you need to reset the DataSource and call Clear before setting the DataSource to your desired source and calling DataBind().