Selected text within a cell

How do I get/set the selected text within a textbox cell? Related to that, how do I get/set the caret position within the textbox?


1 Reply

JJ Jisha Joy Syncfusion Team October 16, 2008 08:44 AM UTC

Hi,

We appreciate your interest in Syncfusion Products.

The selected Text from Grid Cell.

Thix=s can be achieved by handling the CurrentCellActivated event and getting the CurrentCell Renderer. Please refer the code:

void gridControl1_CurrentCellActivated(object sender, EventArgs e)
{
GridCellRendererBase tbr = null;
tbr = this.gridControl1.CurrentCell.Renderer;
string str;
tbr.GetSelectedText(out str);
this.label1.Text = str;
}


Regarding Caret position

This can be achieved by setting the ActivateCurrentCellBehavior property. Please refer the code:

this.gridControl1.ActivateCurrentCellBehavior = GridCellActivateAction.PositionCaret;

Please try this and let me know if this helps.

Regards,
Jisha


Loader.
Up arrow icon