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.

GroupingGrid and related tables

Thread ID:

Created:

Updated:

Platform:

Replies:

47318 Aug 2,2006 12:17 PM Aug 3,2006 10:28 AM Windows Forms 2
loading
Tags: Grouping
Asidagk
Asked On August 2, 2006 12:17 PM

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.

Pictures.zip

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

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

Asidagk
Replied On August 3, 2006 10:28 AM

Hi,

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;
}

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.

;