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 Programmaticaly force editing

I need to force edit mode on one of griddatacontrol cells programmatically. When user enters particular value into one of grid editable cells I need to force him to insert some text into another colum, by switching focus, starting edit mode and making sure user did enter text (empty string validation). How can I achieve that ?

4 Replies

SM Saravanan M Syncfusion Team March 13, 2014 05:37 PM UTC

Hi Viban

 Thanks for contacting Syncfusion support,

 We have analyzed your query. If you want to force edit by programatically, you need to achieve by using MoveTo method. We have prepared a  sample based on your requirement and you can download it from below attachment.

 Please let us know if you have any queries,



Attachment: GridDataControlSample_6671efa2.zip

OM Ole Myrbakken April 22, 2014 01:30 PM UTC

I'm also trying to force a cell in GridDataControl into edit mode. I have tried the sample-solution postet above, but I'm facing some problems.

In the sample solution, I don't get into editmode unless I'm already in edit mode in another cell when pushing the "MakeEdit" button. If I select a row without getting into editmode, push the button so get moved to another row and cell, the cell will not be in edit mode.

Tested in a real life application, the use of moveto after clicking a button made the edit mode work every other time. When not working, the button clicked would still have focus. When debugging, the currentcell always was correct, but the cell was still not put in edit mode. It always looked selected.
1. try: cell looked selected, button had focus, cell not in editmode
2. try: cell looked selected, button had lost focus, cell was in editmode
3. try: cell looked selected, button had focus, cell not in editmode
4. try: cell looked selected, button had lost focus, cell was in editmode
5. try: cell looked selected, button had focus, cell not in editmode
...and so on

If put something else in focus before doing MoveTo and BeginEdit, the button never had focus after being clicked, but the cell never went into editmode either. It still look like it was selected.

Would appreciate an example where you click a button that create a new row, and then automatically go into edit mode in a cell. I haven't been able to get it to work properly. It looks selected, but I can't write anything.

SM Saravanan M Syncfusion Team April 24, 2014 04:30 PM UTC

Hi Ole,

Thanks for your update,

We have analyzed your query. You can add the new row when you click the button and you need to call BeginEdit(true) method to enter the edit mode where you can start type the data automatically. If you change the CurrentCell by pressing Tab/Arrow key it will automatically enter into edit mode. We need to hook CurrentCellMoved event and call the BeginEdit(true) method. Please refer the below code snippet to achieve your requirement.

 Code snippet[C#]:

  private void Button_Click(object sender, RoutedEventArgs e)


    this.SyncGrid.Model.CurrencyManager.CurrentCell.MoveTo(1, 0);




 We have prepared a sample based on your requirement and you can download the sample from the attachment.



Attachment: GridDataControlSample_CurrentCellEditMode_18762729.zip

OM Ole Myrbakken April 25, 2014 06:56 AM UTC

Thank you! It now works smoothly :)

The BeginEdit(true) fixed it. I had copied the BeginEdit() from the other sample, and didn't realize I had to enter a bool to get it to work properly.

Live Chat Icon For mobile
Up arrow icon