Telerik controls v2010.1.10.504
The default behavior in a textbox column in a gridview is to have the text auto-selected when the cell is clicked. We have a requirement to override that behavior because typing can overwrite the entire contents, which our users don't want.
Unfortunately, if I do it via the CellFormatting event, then a race condition occurs if I manually try to select all the text and it becomes difficult to "Select All" to copy the cell contents. I have the CellClick clearing the text fine, it's actually when the embedded control is clicked in the cell which I'm unable to override.
I could only find the "EditorRequired" event as being fired when the GridViewTextBoxColumn is clicked (not the cell, but the embedded control in the cell), but at that time the ActiveEditor is not set, so I'm unable to access the underlying control and "Select(0,0)".
Please tell me how to override the default behavior.
Thank you.
Here is a sample code slice from the CellClick handler so you can see what I'm doing:
The default behavior in a textbox column in a gridview is to have the text auto-selected when the cell is clicked. We have a requirement to override that behavior because typing can overwrite the entire contents, which our users don't want.
Unfortunately, if I do it via the CellFormatting event, then a race condition occurs if I manually try to select all the text and it becomes difficult to "Select All" to copy the cell contents. I have the CellClick clearing the text fine, it's actually when the embedded control is clicked in the cell which I'm unable to override.
I could only find the "EditorRequired" event as being fired when the GridViewTextBoxColumn is clicked (not the cell, but the embedded control in the cell), but at that time the ActiveEditor is not set, so I'm unable to access the underlying control and "Select(0,0)".
Please tell me how to override the default behavior.
Thank you.
Here is a sample code slice from the CellClick handler so you can see what I'm doing:
if
(
"GridViewTextBoxColumn"
== ((Telerik.WinControls.UI.GridDataCellElement)(sender)).GridControl.CurrentColumn.GetType().Name)
{
RadTextBoxEditor rtbe = ((Telerik.WinControls.UI.GridDataCellElement)(sender)).GridControl.ActiveEditor
as
RadTextBoxEditor;
if
(
null
!= rtbe)
{
RadTextBoxEditorElement tbElement = (RadTextBoxEditorElement)rtbe.EditorElement;
tbElement.Select(0, 0);
}
}