I execute the following code to delete child records :
GridBoundRecordState rs = null;
CurrencyManager cm = null;
for ( int i = bookmarks.Length - 1; i >= 0; i-- )
rs = this.Binder.GetRecordStateAtRowIndex(bookmarks[i]);
if (rsType == RowSelectionType.ParentRows)
cm = rs.ListManager as CurrencyManager;
if (rsType == RowSelectionType.ChildRows)
int row = this.Model.RowCount-1;
while (row >= this.FirstDataRow)
rs = this.Binder.GetRecordStateAtRowIndex(row);
if (rs.LevelIndex == 0 && this.IsExpandedAtRowIndex(row))
If I delete the only child record, the + sign disappears. What needs to be done to make it visible again?
I add child records via a context menu and even if I add a child record to this parent (confirmed that I had a matching foreign key) and do a CollapseAll & ExpandAll, the record doesn''t show up in the grid (and neither does the +).
To add to the previous post, the add logic works fine if there''s already a "+" present.
ADAdministrator Syncfusion Team June 17, 2004 12:26 AM
Here is a forum thread that discusses this problem.
LSLori S. PearsallJune 17, 2004 07:21 AM
I''m a bit concerned about this approach. My
Parent is a DataTable and so is the Child and their relation is a DataRelation. What is the implication of adding a "blank" record under the covers? When I ultimately do a DataAdapter.Update are these blank records going to be pushed to the database?
ADAdministrator Syncfusion Team June 17, 2004 07:30 AM
I thought you were trying to add a child record to a parent that currently had no children.
(The referenced thread did this, adding the appropriate values so the child record so it was not blank, but was populated with the key values so it satisfied the relation so it was put under the proper parent.)
Are you trying to do something else?
LSLori S. PearsallJune 17, 2004 10:59 AM
No - my mistake. I''ve started doing a ExpandAll/CollapseAll in the Form_Load so that the extraneous "+"''s don''t show up. Now I have a consistent appearance on start-up and when I start deleting child records.
Your code did the trick - thanks once again!