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. Image for the cookie policy date

Gridgroupingcontrol child table values from grandchild table

In the QueryCellStyleInfo event of a gridgroupingcontrol, I need to disable/enable certain cells in a grandchild level (3rd level) table based on the ChildTable parent value (2nd level). i.e., from the grandchild level, I need to pull info from the CHILD level table (not the top-most level parent). How would you retrieve the childtable parent record information from a grandchild level table (in VB.net)? Thanks, Robert

2 Replies

Administrator May 18, 2004 05:18 AM UTC

Here is one way you can get at the child table from within the grandchild table.
private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
	GridTable table = this.gridGroupingControl1.GetTable("GrandChildTable");
	if(table != null && table.Equals(e.TableCellIdentity.Table) 
		&& e.TableCellIdentity.DisplayElement is GridRecordRow
		&& e.TableCellIdentity.DisplayElement.Kind != DisplayElementKind.AddNewRecord
		GridRecord rec = e.TableCellIdentity.DisplayElement.ParentChildTable.ParentNestedTable.ParentRecord as GridRecord;
		DataRowView drv = rec.GetData() as DataRowView;
		Console.WriteLine(drv["Name"].ToString() + "  " + drv["childID"].ToString()); //some values

RO Robert May 18, 2004 12:19 PM UTC

perfect!! Thanks Clay.
Live Chat Icon For mobile
Up arrow icon