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

GGC DeleteRecord Throws unhandled exception

with code like this: protected void TableControl_CurrentCellKeyDown(object sender, KeyEventArgs e) { try { GridTableControl gtc = ((GridTableControl)sender); GridCurrentCell pos = gtc.CurrentCell; GridTable gt = gtc.Table; /// ¿donde has estado todo este tiempo? int columna = gtc.TableDescriptor.VisibleColumns.TableDescriptor.ColIndexToField(pos.ColIndex); int fila = pos.RowIndex; int col = pos.ColIndex; if(e.KeyCode == Keys.Delete) { // Verificar esta linea, parece que da error // aunque en definitiva borre. Record r = gt.CurrentRecord; gt.CurrentRecord = gt.Records[gt.Records.IndexOf(r)-1]; r.Delete(); when gt.CurrentRecord.Delete() Or r.Delete, seems to be the same, i get that exception and coudnt handle: System.Data.DeletedRowInaccessibleException: No se puede obtener acceso a la información eliminada de una fila. at System.Data.DataRow.GetDefaultRecord() at System.Data.DataRow.GetRecordFromVersion(DataRowVersion version) at System.Data.DataRow.get_Item(DataColumn column, DataRowVersion version) at System.Data.DataRowView.GetColumnValue(DataColumn column) at System.Data.DataColumnPropertyDescriptor.GetValue(Object component) at Syncfusion.Grouping.FieldDescriptor._GetValue(Record record) catched at Syncfusion.Grouping.FieldDescriptor._GetValue(Record record) in :line 0 the program seems work fine after that, but there is any reason for t behavior?

4 Replies

AD Administrator Syncfusion Team June 14, 2005 11:50 PM UTC

I tweaked your code in this sample that uses the TableControlCurrentCellKeyDown event (not CurrentCellKeyDown) to delete the current row. http://www.syncfusion.com/Support/user/uploads/GGC_ExpressionCOl_1448f651.zip Will this work in your case?


LJ Luis Javier Mompart June 15, 2005 06:44 AM UTC

happens the same, iam trying to trigger some intermediate event, because i think that some other (event) is accesing the underlying list between deleting and deleted events. these are my hooked events, this.TableControl.QueryNextCurrentCellPosition+=new GridQueryNextCurrentCellPositionEventHandler(TableControl_QueryNextCurrentCellPosition); this.TableControl.CurrentCellDeactivated+=new GridCurrentCellDeactivatedEventHandler(TableControl_CurrentCellDeactivated); this.TableControl.CurrentCellActivated+=new EventHandler(TableControl_CurrentCellActivated); this.TableControl.CurrentCellKeyDown+=new KeyEventHandler(TableControl_CurrentCellKeyDown); this.TableControlCurrentCellKeyDown+=new GridTableControlKeyEventHandler(ReferenciasGrid_TableControlCurrentCellKeyDown); this.TableControl.CurrentCellValidating += new System.ComponentModel.CancelEventHandler(TableControl_CurrentCellValidating); this.TableControl.ScrollbarsVisibleChanged+=new EventHandler(TableControl_ScrollbarsVisibleChanged); this.TableModel.QueryCoveredRange+=new GridQueryCoveredRangeEventHandler(TableModel_QueryCoveredRange); and i had implemented a custom engine (Factory) to group and operate at the section level. im starting to realize that need to know more about TableModel (rendering and performance reasons?, some tips?). I think could help (not seems to help send you source code because of the weight of it).


LJ Luis Javier Mompart June 15, 2005 08:37 AM UTC

another stack trace that could focus the issue is that when i scroll the vertical scroll bar i receive: Count = 0 YAmountCount = 12 FilteredRecordCount = 0 ElementCount = 0 RecordCount = 0 CustomCount = 0 VisibleCustomCount = 0 Count = 1 YAmountCount = 0 FilteredRecordCount = 0 ElementCount = 2 RecordCount = 0 CustomCount = 0 VisibleCustomCount = 0 System.ArgumentOutOfRangeException: Count = 0 YAmountCount = 12 FilteredRecordCount = 0 ElementCount = 0 RecordCount = 0 CustomCount = 0 VisibleCustomCount = 0 out of range Count = 1 YAmountCount = 0 FilteredRecordCount = 0 ElementCount = 2 RecordCount = 0 CustomCount = 0 VisibleCustomCount = 0 Nombre del parámetro: searchPosition at Syncfusion.Collections.BinaryTree.TreeTableWithCounter.GetEntryAtCounterPosition(ITreeTableCounter start, ITreeTableCounter searchPosition, Int32 cookie, Boolean preferLeftMost) at Syncfusion.Collections.BinaryTree.TreeTableWithCounter.GetEntryAtCounterPosition(ITreeTableCounter searchPosition, Int32 cookie, Boolean preferLeftMost) at Syncfusion.Grouping.Internals.ElementTreeTable.GetEntryAtCounterPosition(Counter searchPosition, Int32 counterKind, Boolean leftMost) at Syncfusion.Grouping.Internals.ElementTreeTable.GetEntryAtCounterPosition(Counter searchPosition, Boolean leftMost) at Syncfusion.Grouping.Internals.ElementTreeTable.GetEntryAtCounterPosition(Counter searchPosition) at Syncfusion.Grouping.Internals.ElementHelper.GetEntryAtCounterPosition(ElementTreeTable table, Counter counter) at Syncfusion.Grouping.Internals.ElementHelper.GetEntryAtCounterPosition(Element el, Counter counter) at Syncfusion.Grouping.Internals.ElementHelper.GetElementAtCounterPosition(Element el, Counter counter) at Syncfusion.Grouping.Internals.ElementHelper.__FindElement(Table _table, Counter index, Type t, Boolean stepInNestedTables) at Syncfusion.Grouping.Internals.ElementHelper.FindElement(Table _table, Counter index, Boolean stepInNestedTables) at Syncfusion.Grouping.RuntimeElementsInTableCollection.GetItemAtYAmount(Double index) catched at Syncfusion.Grouping.RuntimeElementsInTableCollection.GetItemAtYAmount(Double index) in :line 0 Count = 0 YAmountCount = 12 FilteredRecordCount = 0 ElementCount = 0 RecordCount = 0 CustomCount = 0 VisibleCustomCount = 0 Count = 1 YAmountCount = 0 FilteredRecordCount = 0 ElementCount = 2 RecordCount = 0 CustomCount = 0 VisibleCustomCount = 0 Count = 0 YAmountCount = 13 FilteredRecordCount = 0 ElementCount = 0 RecordCount = 0 CustomCount = 0 VisibleCustomCount = 0 Count = 1 YAmountCount = 0 FilteredRecordCount = 0 ElementCount = 2 RecordCount = 0 CustomCount = 0 VisibleCustomCount = 0 System.ArgumentOutOfRangeException: Count = 0 YAmountCount = 13 FilteredRecordCount = 0 ElementCount = 0 RecordCount = 0 CustomCount = 0 VisibleCustomCount = 0 out of range Count = 1 YAmountCount = 0 FilteredRecordCount = 0 ElementCount = 2 RecordCount = 0 CustomCount = 0 VisibleCustomCount = 0 Nombre del parámetro: searchPosition at Syncfusion.Collections.BinaryTree.TreeTableWithCounter.GetEntryAtCounterPosition(ITreeTableCounter start, ITreeTableCounter searchPosition, Int32 cookie, Boolean preferLeftMost) at Syncfusion.Collections.BinaryTree.TreeTableWithCounter.GetEntryAtCounterPosition(ITreeTableCounter searchPosition, Int32 cookie, Boolean preferLeftMost) at Syncfusion.Grouping.Internals.ElementTreeTable.GetEntryAtCounterPosition(Counter searchPosition, Int32 counterKind, Boolean leftMost) at Syncfusion.Grouping.Internals.ElementTreeTable.GetEntryAtCounterPosition(Counter searchPosition, Boolean leftMost) at Syncfusion.Grouping.Internals.ElementTreeTable.GetEntryAtCounterPosition(Counter searchPosition) at Syncfusion.Grouping.Internals.ElementHelper.GetEntryAtCounterPosition(ElementTreeTable table, Counter counter) at Syncfusion.Grouping.Internals.ElementHelper.GetEntryAtCounterPosition(Element el, Counter counter) at Syncfusion.Grouping.Internals.ElementHelper.GetElementAtCounterPosition(Element el, Counter counter) at Syncfusion.Grouping.Internals.ElementHelper.__FindElement(Table _table, Counter index, Type t, Boolean stepInNestedTables) at Syncfusion.Grouping.Internals.ElementHelper.FindElement(Table _table, Counter index, Boolean stepInNestedTables) at Syncfusion.Grouping.RuntimeElementsInTableCollection.GetItemAtYAmount(Double index) Count = 0 YAmountCount = 13 FilteredRecordCount = 0 ElementCount = 0 RecordCount = 0 CustomCount = 0 VisibleCustomCount = 0 Count = 1 YAmountCount = 0 FilteredRecordCount = 0 ElementCount = 2 RecordCount = 0 CustomCount = 0 VisibleCustomCount = 0 Count = 0 YAmountCount = 16 FilteredRecordCount = 0 ElementCount = 0 RecordCount = 0 CustomCount = 0 VisibleCustomCount = 0 Count = 1 YAmountCount = 0 FilteredRecordCount = 0 ElementCount = 2 RecordCount = 0 CustomCount = 0 VisibleCustomCount = 0 System.ArgumentOutOfRangeException: Count = 0 YAmountCount = 16 FilteredRecordCount = 0 ElementCount = 0 RecordCount = 0 CustomCount = 0 VisibleCustomCount = 0 out of range Count = 1 YAmountCount = 0 FilteredRecordCount = 0 ElementCount = 2 RecordCount = 0 CustomCount = 0 VisibleCustomCount = 0 Nombre del parámetro: searchPosition at Syncfusion.Collections.BinaryTree.TreeTableWithCounter.GetEntryAtCounterPosition(ITreeTableCounter start, ITreeTableCounter searchPosition, Int32 cookie, Boolean preferLeftMost) at Syncfusion.Collections.BinaryTree.TreeTableWithCounter.GetEntryAtCounterPosition(ITreeTableCounter searchPosition, Int32 cookie, Boolean preferLeftMost) at Syncfusion.Grouping.Internals.ElementTreeTable.GetEntryAtCounterPosition(Counter searchPosition, Int32 counterKind, Boolean leftMost) at Syncfusion.Grouping.Internals.ElementTreeTable.GetEntryAtCounterPosition(Counter searchPosition, Boolean leftMost) at Syncfusion.Grouping.Internals.ElementTreeTable.GetEntryAtCounterPosition(Counter searchPosition) at Syncfusion.Grouping.Internals.ElementHelper.GetEntryAtCounterPosition(ElementTreeTable table, Counter counter) at Syncfusion.Grouping.Internals.ElementHelper.GetEntryAtCounterPosition(Element el, Counter counter) at Syncfusion.Grouping.Internals.ElementHelper.GetElementAtCounterPosition(Element el, Counter counter) at Syncfusion.Grouping.Internals.ElementHelper.__FindElement(Table _table, Counter index, Type t, Boolean stepInNestedTables) at Syncfusion.Grouping.Internals.ElementHelper.FindElement(Table _table, Counter index, Boolean stepInNestedTables) at Syncfusion.Grouping.RuntimeElementsInTableCollection.GetItemAtYAmount(Double index) and cant handle again


AD Administrator Syncfusion Team June 15, 2005 09:43 AM UTC

Just something to try. In your keydown handler where you handle teh delete key, try setting e.Inner.Handled = true; to make sure nothing else happens because of teh delete key. If that does not affect things, you might comment out the lines where you subscribe to those events to see if that makes the problem go away. If it does, then add them back one at the time to home in on what event(s) is affecting things. Are you using 3.2.1.0? I assume the sample above deleted without a problem, correct?

Loader.
Live Chat Icon For mobile
Up arrow icon