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

Selecting Cell

Can someone explain to me how to select a cell programmatically? I can''t seem to find any documentation on this functionality. Thanks.

Mark

4 Replies

AD Administrator Syncfusion Team August 29, 2006 08:09 PM UTC

If I''m understanding what you want, I believe all you need to do is call grid.Selections.SelectRange(GridRangeInfo.Cell(rowIndex, colIndex), true) to select a single cell.


MA Mark August 29, 2006 11:33 PM UTC

If I try to do that the whole cell is selected which is not what I intend to do.

Maybe I am going about it the wrong way but what I have is an event that I capture CurrentCellActivating and what I do is set e.Cancel = true and then call the same function you just referred to but what happens is the whole cell is selected (the bahviour I want is to mimick the clicking inside of a cell to edit it). Is there something that I am doing wrong or could do differently to achieve what I want?

>If I''m understanding what you want, I believe all you need to do is call grid.Selections.SelectRange(GridRangeInfo.Cell(rowIndex, colIndex), true) to select a single cell.


MA Mark August 30, 2006 12:31 AM UTC

I finally worked out a way to do it...

Within the CurrentCellActivating I do the following;

e.Cancel = true;

Then I hooked up a handler to the event CurrentCellActivateFailed where I do the following;

gridControl1.CurrentCell.Activate(e.RowIndex, e.ColIndex - 1);


This works perfect. Thanks for your help.

>If I''m understanding what you want, I believe all you need to do is call grid.Selections.SelectRange(GridRangeInfo.Cell(rowIndex, colIndex), true) to select a single cell.


AD Administrator Syncfusion Team August 30, 2006 01:01 PM UTC

Mark,

I''m confused. You''re canceling the activation, then you''re activating the cell?

What you really might want to do is look at the GridControl.ActivateCurrentCellBehavior. There are several options for what you can have it do when it activates.

Or are you talking about selecting the all the text in the cell when you activate it? If that''s the case, then look at the GridCellActivateAction.SelectAll option.

Pete

Loader.
Live Chat Icon For mobile
Up arrow icon