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

How to activate the cell in grid in edit mode

Hi,

Can some please tell how do i activate a cell in edit mode. The activated cell should show in edit mode so that the user can edit.


7 Replies

JJ Jisha Joy Syncfusion Team January 8, 2009 05:50 AM UTC

Hi Manoj,

Please try the following code and let me know it this helps.

private void Form1_Load(object sender, EventArgs e)
{

this.gridControl1.CurrentCell.MoveTo(2, 2);
this.gridControl1.CurrentCell.BeginEdit();
}
Regards,
Jisha



AD Administrator Syncfusion Team January 9, 2009 07:43 AM UTC

Hi Jisha,

Thank you for you reply. I already tried this but it is not working. I will tell you the exact scenario.

We are using a grid with two columns that exactly looks like PropertyGrid. The first column is a read only column and the second column is an editable column. When the user clicks on a menu item a dialog pops up with this grid so, i want to point my cursor on the selected row index. which is not happening.

I am attaching a small image. This is how it shows when i use the MoveTo and BeginEdit methods.


>Hi Manoj,

Please try the following code and let me know it this helps.

private void Form1_Load(object sender, EventArgs e)
{

this.gridControl1.CurrentCell.MoveTo(2, 2);
this.gridControl1.CurrentCell.BeginEdit();
}
Regards,
Jisha





Cell_Activate_38a049bf.zip


JJ Jisha Joy Syncfusion Team January 12, 2009 06:33 AM UTC

Hi Manoj.

Please use the following code and let me know if this does not meet your requirements.

private void button1_Click(object sender, EventArgs e)
{
this.gridControl1.Focus();
this.gridControl1.CurrentCell.MoveTo(2, 2,GridSetCurrentCellOptions.SetFocus);
this.gridControl1.CurrentCell.BeginEdit();

}

Regards,
Jisha



AD Administrator Syncfusion Team July 2, 2009 01:18 PM UTC

Jisha,

I have virtually the same situation and the code you supply
fails in a very subtle way.

The issue in my case is that I have set the grid to

grid1.ActivateCurrentCellBehavior = gridCellActivateAction.SelectAll

and that behavior is *not* being respected.

With your code, the cell activates, it goes into editing mode, but the current text in the cell is not selected.

I may be missing something, but I cannot find any methods to force the renderer (from code) to select the entire contents of the cell.

Thanks
-Ralph


RC Rajadurai C Syncfusion Team July 8, 2009 01:53 PM UTC

Hi Ralph,

Thanks for your interest in Syncfusion Products.

If you would like to force the renderer of the currentcell to get the SelectAll functionality, please try to handle CurrentCellActivated event with the following code.

GridCurrentCell cc = this.gridControl1.CurrentCell;
if (cc.Renderer is GridTextBoxCellRenderer)
{
GridTextBoxCellRenderer rend = cc.Renderer as GridTextBoxCellRenderer;
if (rend != null)
{
TextBox tb = rend.Control as TextBox;
tb.SelectAll();
}
}


Regards,
Rajadurai


LW Lucas Wundervald replied to Jisha Joy March 15, 2018 06:10 PM UTC

Hi Manoj,

Please try the following code and let me know it this helps.

private void Form1_Load(object sender, EventArgs e)
{

this.gridControl1.CurrentCell.MoveTo(2, 2);
this.gridControl1.CurrentCell.BeginEdit();
}
Regards,
Jisha


Yes


AR Arulpriya Ramalingam Syncfusion Team March 16, 2018 06:27 AM UTC

Hi Lucas, 
 
Thanks for the update, please let us know whether you need any further assistance on this. 
 
Regards, 
Arulpriya 


Loader.
Live Chat Icon For mobile
Up arrow icon