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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GroupingGrid and related tables

Thread ID:





47318 Aug 2,2006 04:17 PM UTC Aug 3,2006 02:28 PM UTC WinForms 2
Tags: Grouping
Asked On August 2, 2006 04:17 PM UTC

Hi, I have two questions.

1. How can I deny editing, deleting, adding records in related tables
2. How can I deny drawing related table if that table don''t contain any records.

Please look at attached pictures.


Administrator [Syncfusion]
Replied On August 3, 2006 07:11 AM UTC

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

Let me know if you need any further assistance.

Replied On August 3, 2006 02:28 PM UTC


Thanx alot. That was helpful.
Finally, i disabled editing and deleting in this way..

foreach (GridRelationDescriptor var in this.gridGroupingControl1.TableDescriptor.Relations)
var.ChildTableDescriptor.AllowRemove = false;
var.ChildTableDescriptor.AllowNew = false;
var.ChildTableDescriptor.AllowEdit = false;


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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon 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.Close Icon