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

GGC Selecting Row after moving

I have a GGC that is sorted by a column called "test". I have some code that moves the currently selected row to a new location by adjusting the value for that rows "test" column. How would I go about reselecting that row that was just moved?

4 Replies

AD Administrator Syncfusion Team March 13, 2006 06:55 AM UTC

Hi Chuck, The last accessed record can be retrieved by handling the CurrentRecordContextChange event. Once the last accessed record is known, it can be selected with the following code. this.gridGroupingControl1.Table.SelectedRecords.Add(this.rec); Below is a code snippet. Record rec = null; private void gridGroupingControl1_CurrentRecordContextChange(object sender, Syncfusion.Grouping.CurrentRecordContextChangeEventArgs e) { this.rec = e.Record as Record; } Regards, Calvin.


AD Administrator Syncfusion Team March 13, 2006 08:11 PM UTC

Two problems with that solution: 1. Several other rows get touched so the method to get the record is not going to work, that being said I already have the record that is being moved. 2. Adding the record to the selected records array does not move the current cell to that record it just highlights it. In my QueryCellStyleInfo I put a marker on the current row determined by the currentcell and that doesn''t seems to move doing it this way.


AD Administrator Syncfusion Team March 14, 2006 06:50 AM UTC

Hi Chuck, When a Selected record field of a sorted column is modified by code, it gets reselected in the new position by default. Please refer the attached sample. A record can be set as current by calling rec.SetCurrent() method, and this.gridGroupingControl1.TableControl.CurrentCell.MoveTo(rowIndex,colIndex) can also be tried. When the record is known, its row index can be retrieved by rec.GetRowIndex()method. If you are looking for something different and if you can reproduce the issue in the attached sample and send it back, we can get back soon with a solution. Regards, Calvin.

41769.zip


AD Administrator Syncfusion Team March 14, 2006 05:30 PM UTC

The rec.SetCurrent() works great, thanks!

Loader.
Live Chat Icon For mobile
Up arrow icon