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.
Clay,
I have 6 Total Rows. Out of which I entered data in 2nd, 4th and 6th row.
Now I want to delete 2nd, 4th and 6th row. I am getting the following error at
this.gridDataBoundGrid1.Binder.RemoveRecords(r.Top - 1, r.Bottom - 1);
By using this I get a message saying that "There is no row at position 5"
Please let me know why.
Here is my gridDataBoundGrid1_RowsDeleting Code.
private void gridDataBoundGrid1_RowsDeleting(object sender, Syncfusion.Windows.Forms.Grid.GridRowRangeEventArgs e)
{
//e.Cancel = true;
if(!indeleting)
{
this.gridDataBoundGrid1.BeginUpdate();
this.gridDataBoundGrid1.Binder.SuspendBinding();
indeleting = true;
GridRangeInfoList rangeList = this.gridDataBoundGrid1.Selections.GetSelectedRows(true, false);
if(rangeList.Count > 1)
{
this.gridDataBoundGrid1.Selections.Clear();
int nRanges = rangeList.Count;
for(int i = 0; i < nRanges; ++i )
{
GridRangeInfo r = rangeList[0];
int bottom = r.Bottom;
for(int j = 1; j < rangeList.Count; ++j)
{
if(rangeList[j].Bottom > bottom)
{
r = rangeList[j];
bottom = r.Bottom;
}
}
rangeList.Remove(r);
this.gridDataBoundGrid1.Binder.RemoveRecords(r.Top - 1, r.Bottom - 1);
}
e.Cancel = true;
}
indeleting = false;
this.gridDataBoundGrid1.Binder.ResumeBinding();
this.gridDataBoundGrid1.EndUpdate();
}
}
Thanks
Satish
ADAdministrator Syncfusion Team April 19, 2004 12:48 PM UTC
Hi Satish,
Please make sure that your DataTable has proper rowcount (6 rows).
Here is a sample that has 6 rows.
On selecting the 2nd, 4th and 6th and hitting delete seems to work fine. Do you see the problem in this sample too?
Regards,
Jay N.
Need More Help?
Get personalized assistance from our support team.