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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Deleting rows in GridDataboundGrid

Thread ID:





13028 Apr 19,2004 10:46 AM UTC Apr 19,2004 12:48 PM UTC WinForms 1
Tags: GridControl
Asked On April 19, 2004 10:46 AM UTC

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

Administrator [Syncfusion]
Replied On 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.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon