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

GridDataBoundGrid - Selecting Text Within a Cell Programatically

Hi,

I need to select the text within a specific cell programatically. I am using the GridDataBoundGrid.

Currently, when a user opens a grid drop down box, if they want to start typing to get to their item faster, they have to manually select or delete the text in that cell. Because of this, I want to select the text automatically when they open a drop down box.

Anyone know how to select text programatically?

Thanks

1 Reply

RC Rajadurai C Syncfusion Team March 4, 2010 03:00 PM UTC

Hi Jeffrey,

Thanks for your interest in Syncfusion Products.

To set the text selected in the dropdowncell on opening the dropdown, you can handle the CurrentCellShowingDropDown event with the following kind of code which is used for Combobox cell in GridDataBoundGrid.

//Method Invoker
this.gridDataBoundGrid1.CurrentCellShowingDropDown += new Syncfusion.Windows.Forms.Grid.GridCurrentCellShowingDropDownEventHandler(gridDataBoundGrid1_CurrentCellShowingDropDown);

//gridDataBoundGrid1_CurrentCellShowingDropDown
GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
if (cc.Renderer is GridComboBoxCellRenderer)
{
GridComboBoxCellRenderer rend = cc.Renderer as GridComboBoxCellRenderer;
if (rend != null)
rend.TextBox.SelectAll();
}

Regards,
Rajadurai

Loader.
Live Chat Icon For mobile
Up arrow icon