I have an UltraGrid that uses a generic list for a DataSource. I update the list in a separate form and then re-attach the list to the UltraGrid's DataSource. The DataSource reflects the changes, but the grid isn't showing them. Here is my code:
List<SubtypeColorCode> subtypeColorCodes; if (this.subtypeColorCodesUltraGrid.DataSource is List<SubtypeColorCode>) subtypeColorCodes = (List<SubtypeColorCode>)this.subtypeColorCodesUltraGrid.DataSource; else //If the data source hasn't been initialized. subtypeColorCodes = new List<SubtypeColorCode>(); SubtypeColorCodeForm.ShowForm(this, new ImageServerProxy(this.tbImagingUri.Text), subtypeColorCodes); //Assign the updated subtype list back to the data source. this.subtypeColorCodesUltraGrid.DataSource = subtypeColorCodes;
Hi,
Well, if that works for you, I'm glad you solved it. But you should not have to call DataBind. Setting the DataSource on the grid to a new data source implicitly causes a DataBind operation, anyway.
The only time you would need to call DataBind is if you are setting the grid's DataSource to the same instance of an object. Since you are using a new instance in the code you have here, it should not be needed.
Turns out I just need to call .DataBind() on the UltraGrid to show the changes to the data source.
I don't see anything here that would cause the grid not to display the new data.
Can you post a small sample project demonstrating the issue so we can see what's going on?