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 records in hierarchical grid

Thread ID:

Created:

Updated:

Platform:

Replies:

27816 Apr 19,2005 04:54 AM Apr 19,2005 05:51 AM Windows Forms 2
loading
Tags: GridControl
Kjetil Kåresen
Asked On April 19, 2005 04:54 AM

I need to delete records in a two level grid (both on parent and child level). I use GridSelectionFlags.Any. The following code works foreach(GridTable gt in this.gridGroupingControl1.Engine.EnumerateTables()) { if(gt.CurrentRecord != null) { int rowIndex = gridGroupingControl1.TableControl.CurrentCell.RowIndex; int colIndex = gridGroupingControl1.TableControl.CurrentCell.ColIndex; gt.CurrentRecord.Delete(); gridGroupingControl1.TableControl.CurrentCell.MoveTo(rowIndex, colIndex); return; } } However, if I delete in the child grid, there is not current cell after the deletion. What should I do to set a current cell after the deletion in the child grid?

Administrator [Syncfusion]
Replied On April 19, 2005 05:05 AM

Try using this code: int i = gt.FilteredRecords.IndexOf(gt.CurrentRecord); gt.CurrentRecord.Delete(); gt.CurrentRecord = gt.FilteredRecords[i];

Kjetil Kåresen
Replied On April 19, 2005 05:51 AM

I added the following tests to your code int i = gt.FilteredRecords.IndexOf(gt.CurrentRecord); if(i < 0) return; gt.CurrentRecord.Delete(); if(i >= gt.FilteredRecords.Count) return; gt.CurrentRecord = gt.FilteredRecords[i]; Now it works perfect. Thanks. Your help is invaluable and has convinced me to buy the Syncfusion package.

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.

;