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

Start a CellEdit programmatically

Is there a way any of you know to start the edit process on a cell programmatically? Basically, I have the user clicking an "Add" button which adds a new row to my DataGrid. I select the first new cell in that row automatically, but the user still has to click, double-click, or press F2 to start editing. Is there a way to start that through code instead? I have tried raising a KeyDown event on the DataGrid (using DataGrid.RaiseEvent) but that doesn't seem to be working.

Also, how do you change the color of the grid lines?

Thanks in advance.

1 Reply

SH Shakul Hameed M Syncfusion Team December 5, 2013 08:32 AM UTC

Hi Branden,

 

Thanks for contacting Syncfusion.

 

We have analyzed your query and we can achieve your requirement by using BeginEdit() method like in the below code snippt.

Please refer the following code snippet.

 

Code Snippet:

private void AddButton_Click(object sender, RoutedEventArgs e)

        {

            this.GridDataControl1.ShowAddNewRow = true;          

            this.GridDataControl1.Model.Grid.CurrentCell.MoveTo(1, 0);

            this.GridDataControl1.Model.Grid.CurrentCell.BeginEdit(true);

        }

 

We have prepared a sample based on your requirement. In this, I have added a new now, and moved the current cell position to that new row.

And then start the editable process by using BeginEdit() method.

 

Please find the sample from the below location:

 

Sample: BeginEdit.zip

 

Please let us know if you need further assistance,

 

Thanks,

Shakul Hameed


Loader.
Live Chat Icon For mobile
Up arrow icon