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.
ADAdministrator Syncfusion Team March 20, 2007 02:34 PM UTC
Hi Lim,
The DeleteRecordsAtRowIndex method removes the records at specfied rows from the grid and its underlying datasource. Before the rows are deleted, a cencelable RowDeleting event is raised. After the rows are deleted, a RowDeleted event is raised. It takes two argument.
first - The first row to delete from the grid. last - The last row to delete from the grid.
If you want to delete records based on its zero base position of the grid then use RemoveRecords method from GridModelDataBinder class. The Binder.RemoveRecords method removes the specified records from the datasource (without sending a RowsDeleting event; use DeleteRecordsAtRowIndex instead if you need it. It also takes two argument.
first -The zero-based position of the first record. last -The zero-based position of the last record.
Best Regards, Haneef
ADAdministrator Syncfusion Team March 21, 2007 05:38 AM UTC
Hi Haneef ,
The problem is still exists.. My code is as following:
foreach (GridRangeInfo r in this.dgCutLot.Selections.GetSelectedRows(true, true)) { //dgCutLot.DeleteRecordsAtRowIndex(r.Top, r.Bottom); dgCutLot.Binder.RemoveRecords(r.Top-1, r.Bottom-1); }
The GridRangeInfo r is R1 and R10. There are total of 10 records and i want to delete Row 1 and Row 10, but after Row 1 is deleted the index was changed.. The error code is "There is no row at position 9".
Please help! thanks!
Regards, lim
ADAdministrator Syncfusion Team March 21, 2007 04:39 PM UTC
Hi Lim,
You can try this code.
foreach (GridRangeInfo r in this.gridDataBoundGrid1.Model.Selections.GetSelectedRows(true, true)) { int iTotalRows = this.gridDataBoundGrid1.Model.RowCount; int iBottom = r.Bottom -1; if (this.gridDataBoundGrid1.EnableAddNew) iTotalRows -= 1; if (r.Top > iTotalRows) return; else if (r.Bottom > iTotalRows) iBottom = iTotalRows -1; this.gridDataBoundGrid1.Binder.RemoveRecords(r.Top - 1, iBottom ); }