I have a situation where I need to do both of these but I'm having problems with it. I'm using LoadOnDemand=XML so I need OnInitializeDataSource.
I have a button whose server side event changes some data, but since the OnInitializeDataSource event fires before the button's event the data that's sent to the client is already old. So what I tried to do was set the datasource property and call DataBind. What ends up happening is I get blank columns where the data normally is. I also tried calling OnInitializeDataSource instead of DataBind but the data was still old.
void MyGrid_InitializeDataSource(object sender, Infragistics.WebUI.UltraWebGrid.UltraGridEventArgs e){MyGrid.DataSource = GetData(); }
private void btnAdd_ServerClick(object sender, System.EventArgs e){// Change the dataRenameItems();MyGrid.DataSource = GetData();MyGrid.DataBind();}
Figured out my problem.
I can call ResetRows() before setting the DataSource and calling DataBind() and everything seems to work as expected. If there's a better way please let me know!
private void btnAdd_ServerClick(object sender, System.EventArgs e){// Change the dataRenameItems();MyGrid.ResetRows();MyGrid.DataSource = GetData();MyGrid.DataBind();}