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.
Unfortunately, activation email could not send to your email. Please try again.

GGC Selecting Row after moving

Thread ID:

Created:

Updated:

Platform:

Replies:

41769 Mar 10,2006 12:36 PM Mar 14,2006 12:30 PM Windows Forms 4
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On March 10, 2006 12:36 PM

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 01:55 AM

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 03:11 PM

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 01:50 AM

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

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

The rec.SetCurrent() works great, thanks!

CONFIRMATION

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.

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.

;