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

Problem in deleting the a row

Hai, I am using GridDataBoundGrid and a contextMenu is associated with it.The grid contains multiple columns .I type in some data in first Column and move to the next column of the same row.When I come back to the first Column and click delete ,Stack overflow Exception is thrown ,The code I am using is this.datagrid.Binder.RemoveRecords(e.From-1, e.To-1 );

3 Replies

AD Administrator Syncfusion Team August 10, 2004 05:47 AM UTC

Where are you trying to call this code? You should not be doing it from within a RowDeleting or RowsDeleted event as this will trigger recursive calls. If you need to do it there, set up a class member that flags whether you are in a delete or not. At the start of the event handler, test this member and return if you are in a delete. If not, set the member to true and perform your delete, and then set this member back to false. This should avoid the recursive calls. Also, before you delete rows, make sure there is not an open edit going on in the grid. Maybe call: if(this.inDelete) return; this.inDelete = true; grid.CurrentCell.EndEdit(); grid.Binder.EndEdit(); grid.Binder.RemoveRecords.... this.inDelete = false;


AR arvind August 10, 2004 07:47 AM UTC

I am using this piece of code in the Row_Deleted event . >Hai, >I am using GridDataBoundGrid and a contextMenu is associated with it.The grid contains multiple columns .I type in some data in first Column and move to the next column of the same row.When I come back to the first Column and click delete ,Stack overflow Exception is thrown ,The code I am using is > >this.datagrid.Binder.RemoveRecords(e.From-1, e.To-1 );


AD Administrator Syncfusion Team August 10, 2004 07:55 AM UTC

You will have to add the flag as suggested above to avoid the recursive call then. Calling RemoveRecords triggers the RowDeleted event, where you call RemoveRecords which triggers the RowsDeleted event where you call RemoveRecords, and so on forever..... and this is why you are seeing the stack overflow.

Loader.
Live Chat Icon For mobile
Up arrow icon