The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
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.
ADAdministrator 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.
>
ADAdministrator Syncfusion Team September 21, 2004 10:50 AM UTC
Set "DataGrid.SelectedIndex = -1". I think it will solve your problem.