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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

23100 Jan 5,2005 01:04 AM UTC Jan 31,2005 07:41 AM UTC WinForms 5
loading
Tags: GridControl
David Bosak
Asked On January 5, 2005 01:04 AM UTC

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 07:37 AM UTC

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 08:23 AM UTC

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 09:50 AM UTC

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(); } }

DavidBosak@venturipartners.com
Replied On January 31, 2005 06:52 AM UTC

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 07:41 AM UTC

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;
		SendKeys.Send("+({HOME})");
	}
}

CONFIRMATION

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.

Warning Icon 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.Close Icon

;