Sellect all text in GridTextBoxControl

Hi,

How can I select all text in GridTextBoxControl, when I start edit?

I tried this:

private void grid_CurrentCellControlGotFocus(object sender, ControlEventArgs e)
{
GridTextBoxControl textBox = grid.CurrentCell.Renderer.Control as GridTextBoxControl;

if (textBox != null)
{
textBox.SelectionStart = 0;
textBox.SelectionLength = textBox.Text.Length;
}
}


But this didn't work.


1 Reply

JJ Jisha Joy Syncfusion Team March 25, 2011 07:30 AM UTC

Hi Juraj,

You can achieve the desired behavior by setting the ActivateCurrentCellBehavior property to GridCellActivateAction.SelectAll. Please refer to the code,

this.gridControl1.ActivateCurrentCellBehavior = GridCellActivateAction.SelectAll;

Regards,
Jisha


Loader.
Up arrow icon