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
close icon

GGC, current row persistance against DataSourse

I have a GGC that is bound to a table. No relationships are created. It is working in the listbox mode: ggc.TableOptions.ListBoxSelectionMode = SelectionMode.One; When I navigate the grid, cursor in the underlying bindingManager changes: this makes sense. When a piece of code deletes the current row, from the table, this row disappears from the grid: makes sense, too After deleting the current row, cursor in the bindingManager changes to the next row in the DataTable, but grid shows that nothing is selected: this does not make sense to me. I can probably catch the event when table changes and make selection manually, but is there a simplier way? Thank you (using v3.0.1.1)

3 Replies

AD Administrator Syncfusion Team August 26, 2005 11:39 PM UTC

I do not know of a simpler way to do this. Here is a sample that uses RecordDeleting to manage this. http://www.syncfusion.com/Support/user/uploads/GGC_Delete_e227177c.zip


AD Administrator Syncfusion Team August 27, 2005 01:33 AM UTC

Thank you. This would have worked if I was to delete records from the grid. According to help, when I delete records directly from the datasource, SourceListListChanged event will be raised. I tried to achive the same functionality in that event with the code similat to what''s below, but failed. My selected row is not VISIBLY selected (but works otherwise!) private void ggcGeneric_SourceListListChanged(object sender, TableListChangedEventArgs e) { GridGroupingControl ggc = sender as GridGroupingControl; BindingManagerBase currency = bindingContext[ggc.DataSource]; Syncfusion.Grouping.Record recToBeSelected = null; if (currency.Position >= 0) { foreach (Syncfusion.Grouping.Record rec in ggc.Table.FilteredRecords) { object p = rec.GetData(); if (p == currency.Current) { recToBeSelected = rec; break; } } } if (recToBeSelected != null) { int rowIndex; rowIndex = ggc.Table.FilteredRecords.IndexOf(recToBeSelected); recToBeSelected.SetCurrent(); } } I''m afraid I would ask you for example, how to manually select a row from within that event.


AD Administrator Syncfusion Team August 27, 2005 09:06 AM UTC

I think you will have to put a slight pause in your event handler to permit the gird to finish what it does there. Otherwise, your settings will later be stepped on by what the grid is doing. Here is a little sample using this technique. http://www.syncfusion.com/Support/user/uploads/GGC_Delete_378496c.zip

Loader.
Live Chat Icon For mobile
Up arrow icon