We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Current Row not refreshing until deselected

Hi, I''ve got a GDBG hierarchical grid very similar to the Customers sample. (ie the grid is bound to a collection which implement IBindingList etc). However, when data is updated in the collection and a row is selected on the grid, the row does not update until another row becomes current and selected. How do I get round this? If I was writing a databinder, I''d force the update of the active row using :- _grid2.RefreshRange(GridRangeInfo, true); However this isn''t applicable in my scenario. Cheers Chris Dugdale

5 Replies

AD Administrator Syncfusion Team June 30, 2004 03:08 PM UTC

In our 2.0 code, you might experiment setting grid.UseOptimizedListChanged true/false to see if either setting has an affect on this problem. If not, can you listen to the IBindingList.ListChanged event of the datasource, and if the position that changes is the current row, you can try calling the grid.RefreshRange code you mentioned.

CD Chris Dugdale July 1, 2004 04:36 PM UTC

Hi, I''ve tried setting OptimzedListChangedEvent = true & false and this has no effect. I''ve also tried checking to see if the row being updated is the current selected row, and if it is I execute :- //Refresh the current selected row if(rowIndexToBeUpdated == _grid.Binder.CurrentPosition) { _grid.RefreshRange(GridRangeInfo.Row _grid.Binder.CurrentPosition),true); } However, this still does not update the selected row until it is deselected. Have you any other suggestions?

AD Administrator Syncfusion Team July 1, 2004 05:40 PM UTC

Did you try listening to IBindingList.Changed event? //to hook teh event after you set the datasource CurrencyManager cm = (CurrencyManager)this.BindingContext[grid.DataSource, grid.DataMember]; IBindingList ibl = cm.List as IBindingList; if(ibl != null) ibl.ListChanged += new ListChangedEventHandler(ibl_ListChanged); //the handler private void ibl_ListChanged(object sender, ListChangedEventArgs e) { if(e.ListChangedType == ListChangedType.ItemChanged) { grid.RefreshRange(GridRangeInfo.Row(e.NewIndex + 1), true); } }

CD Chris Dugdale July 2, 2004 07:26 AM UTC

Hi Clay, I tried the code you suggested and it had no effect. The row still doesnt update until it is de-selected. I''m stuck! Cheers Chris.

AD Administrator Syncfusion Team July 2, 2004 08:21 AM UTC

Can you post a sample showing the problem. I tried to see it with this code in Grid\Samples\DataBound\Hierarchical\Customers and could not. I am using 2051, what are you using?
private void button1_Click(object sender, System.EventArgs e)
	CustomerCollection customers = (CustomerCollection)this.dataGrid1.DataSource;
	Customer cust = customers[0];
	cust.FirstName = "aaaaa";

Live Chat Icon For mobile
Up arrow icon