StrataFrame Forum

Refreshing Grids

http://forum.strataframe.net/Topic11960.aspx

By Tim Dol - 10/12/2007

I'm having problems refreshing data on my grid (Infragistics) when I do the following.  (I don't normally do this but I have a weird situation and this is the only way I can solve it)

I am filling two business objects when I first load a form.  I save off these two BO's into variables. Due to database design I have to physically save data during the editing session.  When I click on the 'Undo' button, I refill the business objects using the saved values (I am using the CopyDateFrom method)

Everything is fine however the grid doesn't reflect the changes.  Any suggestions on how to do this?

Thanks,

Tim

By Peter Jones - 10/12/2007

Hi Tim,

Are you perhaps forgetting to reset your grid's data source, e.g. grid.DataSource = RefreshedCopyOfYourDataTable?

Cheers, Peter

By StrataFrame Team - 10/15/2007

Are you using a BusinessBindingSource?  If so, then your best bet will be to create a new class that inherits from BBS for use with this grid.  THe only thing you will need to do is create a method, say, ResetDataSource() that internally calls OnListChanged and passes a new ListChangedEventArgs.  You can pass Reset for the enum and -1 for the index to the ListChangedEventArgs constructor.  That event is what the grid listens to to refresh the grid.
By StrataFrame Team - 10/15/2007

Then just use that new BBS like normal and call your ResetDataSource() method after you're done with the Undo().