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.
Syncfusion Feedback

Remaining selection on a cell after refresh

Thread ID:

Created:

Updated:

Platform:

Replies:

58805 Mar 28,2007 08:01 PM UTC Mar 30,2007 07:09 AM UTC Windows Forms 4
loading
Tags: GridControl
Andrey Gruber
Asked On March 28, 2007 08:01 PM UTC

Hi!
I update contents of GridControl on timer, but the cell previously selected must remain selected after refresh (i.e. with selection border). I can save its row and col before updating, but how can I programmatically select it again? And show selection BORDER!

Thank you.

haneefm [Syncfusion]
Replied On March 28, 2007 08:36 PM UTC

Hi Andrey,

One way you can do this by using the Model.Selections property. The Model.Selections property allows you to add, remove and get selections, determines selection state of a specific cell. Here is a code

//Before calling the Refresh method you need to store the selected range to the GridRangeInfoList
GridRangeInfoList list;
this.gridControl1.Model.Selections.GetSelectedRanges(out list,true);
this.gridControl1.Refresh();

//and then set the list as selected range in a grid after calling the refresh.
foreach(GridRangeInfo info in list)
this.gridControl1.Model.Selections.Add(info);

Best regards,
Haneef

Andrey Gruber
Replied On March 29, 2007 09:31 AM UTC

Hi, Haneef!
The code above works fine except the fact I need to see a border around the cell, as after mouse click - in the color scheme we work with, the selection color is light gray and is almost not visible. In other words, I need to emulate mouse click on the cell in order to see selection border.

haneefm [Syncfusion]
Replied On March 29, 2007 07:41 PM UTC

Hi Andrey,

Please try this code.

int RowIndex = this.grid.CurrentCell.RowIndex;
int ColIndex = this.grid.CurrentCell.ColIndex;

this.grid.Refresh();

this.grid.CurrentCell.MoveTo( RowIndex,ColIndex ,GridSetCurrentCellOptions.SetFocus);


Best regards,
Haneef

Andrey Gruber
Replied On March 30, 2007 07:09 AM UTC

Thank you - it works!

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.

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

;