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.
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?
ADAdministrator Syncfusion Team April 19, 2005 09:05 AM UTC
Try using this code:
int i = gt.FilteredRecords.IndexOf(gt.CurrentRecord);
gt.CurrentRecord.Delete();
gt.CurrentRecord = gt.FilteredRecords[i];
KKKjetil KåresenApril 19, 2005 09:51 AM UTC
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.