Hi Sergiy,
You can hide the related table that does not contain any records using the QueryCellStyleInfo event of the gridGroupingControl. Here is some code snippet, that prevents the +/- minus for an empty child table.
if (e.TableCellIdentity.TableCellType == GridTableCellType.RecordPlusMinusCell)
{
Record r = e.TableCellIdentity.DisplayElement.ParentRecord as Record;
if (r != null && r.NestedTables.Count > 0 && r.NestedTables[0].ChildTable.GetFilteredRecordCount() == 0)
{
e.Style.CellType = "Static";
}
}
To avoid editing the records in the related tables, the TableControlCurrentCellStartEditing event can be handled and set e.Inner.Cancel to true. Try the below piece of code.
// TableControlCurrentCellStartEditing event handler
Element el = this.gridGroupingControl1.Table.CurrentElement;
if(el != null && el.Kind == DisplayElementKind.NestedTable)
{
e.Inner.Cancel = true;
}
To avoid deleting any records, set e.Cancel to true in the RecordDeleting event of the corresponding TableDescriptor.
GridTableDescriptor child_tabledescriptor1 = this.gridGroupingControl1.TableDescriptor.Relations[0].ChildTableDescriptor;
child_tabledescriptor1.RecordDeleting += new RecordEventHandler(child_tabledescriptor1_RecordDeleting);
private void child_tabledescriptor1_RecordDeleting(object sender, RecordEventArgs e)
{
e.Cancel = true;
}
Here is a sample
GGC_Nested.zip
Let me know if you need any further assistance.
Thanks,
Rajagopal