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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GGC Selecting Row after moving

Thread ID:





41769 Mar 10,2006 05:36 PM UTC Mar 14,2006 05:30 PM UTC WinForms 4
Tags: GridControl
Administrator [Syncfusion]
Asked On March 10, 2006 05:36 PM UTC

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?

Administrator [Syncfusion]
Replied On 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.

Administrator [Syncfusion]
Replied On 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.

Administrator [Syncfusion]
Replied On 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.


Administrator [Syncfusion]
Replied On March 14, 2006 05:30 PM UTC

The rec.SetCurrent() works great, thanks!


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon