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

Howto:? select text in a cell

using this code: GridTextBoxControl tb; if (gridControl1[gridControl1.CurrentCell.RowIndex, gridControl1.CurrentCell.ColIndex].CellType == "TextBox") { tb = (GridTextBoxControl)gridControl1.CurrentCell.Renderer.Control; tb.SelectAll(); } does not work. Is there a better way of doing this? This runs on CurrentCellActivated with the purpose to highlight all text when a user switches cells

5 Replies

Administrator August 27, 2003 07:50 PM UTC

You can set the grid's ActivateCurrentCellBehavior property to SelectAll. This should select all the text for you when you click into a cell. You can do this from the designer or from code in Form_Load.

PE Peter August 27, 2003 10:02 PM UTC

Thanks, that works

SK Sameer Khan February 20, 2009 03:32 PM UTC

I cannot find the corresponding property for a GGC. Does it not support the behavior?

>Thanks, that works


SK Sameer Khan February 20, 2009 03:38 PM UTC


this.gridGroupingControl1.TableModel.Options.ActivateCurrentCellBehavior = GridCellActivateAction.SelectAll Works, but I would like to be able to specify this behavior on a Column level .. is that possible


>I cannot find the corresponding property for a GGC. Does it not support the behavior?

>Thanks, that works




Rajadurai C February 23, 2009 02:14 PM UTC

Hi Sameer,

Thanks for your interest in Syncfusion products.

You can set the SelectAll property for specific column through TableControlCurrentCellActivating event handler. Please refer to the following code.

void gridGroupingControl1_TableControlCurrentCellActivated(object sender, GridTableControlEventArgs e)
{
GridCurrentCell cc = e.TableControl.CurrentCell;
if (cc.RowIndex > 3 && cc.ColIndex > 0)
{
if (cc.ColIndex == 2)
{
this.gridGroupingControl1.TableModel.Options.ActivateCurrentCellBehavior = GridCellActivateAction.SelectAll;
}
else
{
this.gridGroupingControl1.TableModel.Options.ActivateCurrentCellBehavior = GridCellActivateAction.PositionCaret;
}
}
}


Regards,
Rajadurai

Loader.
Live Chat Icon For mobile
Up arrow icon