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

Deleting rows in GridDataboundGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

13028 Apr 19,2004 06:46 AM Apr 19,2004 08:48 AM Windows Forms 1
loading
Tags: GridControl
Satish
Asked On April 19, 2004 06:46 AM

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 08:48 AM

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.

CONFIRMATION

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.

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.

;