How to go recursively through all the detail tables and change appearances of them

Hi,

Perhaps I just didn't find it in the projects and in this forum....

I need to go through all the child tables and change their appearances. For instance I may need to toggle off their insertion row, or change their background color or make them editable or not editable. But I am having a hard time finding some example code that shows me how to do this. Could someone help?




1 Reply

CI Christopher Issac Sunder K Syncfusion Team September 2, 2010 09:11 AM UTC

Hi David,

Thank you for your interest in Syncfusion products.

#1. To toggle of the insertion behavior in the child grid, you can make use of the following code which has been exposed through check box.


private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
this.gridGroupingControl1.GetTableDescriptor("MyChildTable").AllowNew = this.ChkToggle.Checked;
}


#2. To change the background color, use the below code.


this.gridGroupingControl1.GetTableDescriptor("MyChildTable").Appearance.AnyRecordFieldCell.BackColor = Color.Crimson;


#3. Toggle the editing of a child table can be achieved through the “QueryCellStyleInfo” event with the following code.


this.gridGroupingControl1.GetTable("MyChildTable").QueryCellStyleInfo += new GridTableCellStyleInfoEventHandler(Form1_QueryCellStyleInfo);

void Form1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record) // check if it is record.
{
e.Style.ReadOnly = !this.ChkEdit.Checked; // toggle the edit beahviour through check box.
}
}


Please refer the following sample which illustrates the above.

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=GGC_ChildFormatting1502264451.zip

Please let me know if you have any other concerns.

Regards,
Christo.



Loader.
Up arrow icon