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.
Unfortunately, activation email could not send to your email. Please try again.

How can select a cell in the first time clicking on it

Thread ID:





23100 Jan 4,2005 08:04 PM Jan 31,2005 02:41 AM Windows Forms 5
Tags: GridControl
David Bosak
Asked On January 4, 2005 08:04 PM

I am implementing a grid with two Textbox cells: cell #1 is used to select (does not edit) and cell #2 is used to edit. Could you please help me to anwser questions below: 1) How can select all the text in editable cell in the first time clicking on it? 2) for Cell #1, How can it always select all text when cliking on it? thanks for your suporting!

Administrator [Syncfusion]
Replied On January 5, 2005 02:37 AM

I am not sure hwat the difference is between your requests 1 and 2. But you can cause all the text to be selected when you click on a cell by setting this property. this.gridDisplay.ActivateCurrentCellBehavior = GridCellActivateAction.SelectAll;

David Bosak
Replied On January 5, 2005 03:23 AM

Thank you! For question #2, when click many times on cell, how is the text (on the cell) still selected (not select one word of text) ?

Administrator [Syncfusion]
Replied On January 5, 2005 04:50 AM

If you want to selectall on a doubleclick of an active cell (instead of selecting a word), handle the CurrentCellControlDoubleClick event. private void gridControl1_CurrentCellControlDoubleClick(object sender, ControlEventArgs e) { GridTextBoxControl tb = e.Control as GridTextBoxControl; if(tb != null) { tb.SelectAll(); } }

Replied On January 31, 2005 01:52 AM

When using tb.SelectAll() or this.dgrTemplateManagement.ActivateCurrentCellBehavior = Syncfusion.Windows.Forms.Grid.GridCellActivateAction.SelectAll, How to show the text at the beginning of textBox? Thanks!

Administrator [Syncfusion]
Replied On January 31, 2005 02:41 AM

You can try handling the CurrentCellControlGotFocus event.
private void gridDataBoundGrid1_CurrentCellControlGotFocus(object sender, ControlEventArgs e)
	GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
	GridTextBoxControl tb = cc.Renderer.Control as GridTextBoxControl;
	if(tb != null)
		tb.SelectionStart = tb.Text.Length;
		tb.SelectionLength = 0;


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.