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
close icon

"Error when commiting the row to the original data store"

Hi! I have written my own datagridcolumn style. Its functionality is to show an userControl when user wants to edit field in dg. the control works fine, opens proper row, saves changed values in proper fields etc. The only problem is commiting value: when dg tries to commit value, I get following message: "Error when commiting the row to the original data store. Index -1 is not non-negative and below total rows count. Do you want to correct the value? (yes/no)". When I agree, fields are made value 0. When I disagree, exception is thrown: System.IndexOutOfRangeException: Index -1 is not non-negative and below total rows count. at System.Data.DataView.GetElement(Int32 index) at System.Data.DataView.System.Collections.IList.get_Item(Int32 recordIndex) at System.Windows.Forms.CurrencyManager.CancelCurrentEdit() at System.Windows.Forms.DataGrid.HandleEndCurrentEdit() at System.Windows.Forms.DataGrid.OnLeave_Grid() at System.Windows.Forms.Control.InvokeMarshaledCallbacks() I have no idea why index gets negative value? what to do? any ideas? sorry for so long post - i'm getting desperate ;-) thanks for your time h.

2 Replies

AD Administrator Syncfusion Team November 11, 2003 11:38 AM UTC

> Hi! > I have written my own datagridcolumn style. Its functionality is to show an userControl when user wants to edit field in dg. the control works fine, opens proper row, saves changed values in proper fields etc. The only problem is commiting value: when dg tries to commit value, I get following message: "Error when commiting the row to the original data store. Index -1 is not non-negative and below total rows count. Do you want to correct the value? (yes/no)". When I agree, fields are made value 0. When I disagree, exception is thrown: > > System.IndexOutOfRangeException: Index -1 is not non-negative and below total rows count. > at System.Data.DataView.GetElement(Int32 index) > at System.Data.DataView.System.Collections.IList.get_Item(Int32 recordIndex) > at System.Windows.Forms.CurrencyManager.CancelCurrentEdit() > at System.Windows.Forms.DataGrid.HandleEndCurrentEdit() > at System.Windows.Forms.DataGrid.OnLeave_Grid() > at System.Windows.Forms.Control.InvokeMarshaledCallbacks() > > > I have no idea why index gets negative value? what to do? > any ideas? > sorry for so long post - i'm getting desperate ;-) > thanks for your time > h. >


AD Administrator Syncfusion Team September 21, 2004 10:50 AM UTC

Set "DataGrid.SelectedIndex = -1". I think it will solve your problem.

Loader.
Live Chat Icon For mobile
Up arrow icon