Grid Grouping getting child rows

I am trying to get all the values associated with a given row/record. I have around 10 columns and half of them use mapping tables. How do I given a row iterate thru all of the child tables related to the row? I am trying the following but I never get any nested tables: foreach (NestedTable nt in gridGroupingControl1.Table.Records[nRow].NestedTables) { foreach (Record r in nt.Records) { DataRowView dr = r.GetData() as DataRowView; } }

3 Replies

AD Administrator Syncfusion Team October 21, 2005 05:04 PM UTC

Are you referring to hierarchical parent-child tables? If so, take a look at this thread to see if the code posted there does not give you the information you need. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=33743


AD Administrator Syncfusion Team October 21, 2005 05:58 PM UTC

Well that was esentially what I did and the nested tables collection always seems to be empty. Below is a sample of how I create the child tables, so from the row number how would I iterate the mapping table created below? GridTableDescriptor td = gridGroupingControl1.TableDescriptor; string relationName = m_dv.Table.TableName + "_" + dtMap.TableName; gridGroupingControl1.Engine.SourceListSet.Add(new SourceListSetEntry(dtMap.TableName, dtMap.DefaultView)); //Create the relationship between the main table and the mapping table GridRelationDescriptor rd = new GridRelationDescriptor(relationName); rd.ChildTableName = dtMap.TableName; rd.MappingName = relationName; rd.RelationKind = RelationKind.ForeignKeyKeyWords; rd.RelationKeys.Add("id", "map_id"); td.Relations.Add(rd); //Create the relationship between the mapping table and it''s root table string relationName1 = relationName + "_" + dtBase.TableName; GridRelationDescriptor rd1 = new GridRelationDescriptor(); rd1.ChildTableName = dtBase.TableName; rd1.MappingName = relationName1; rd1.RelationKind = RelationKind.ForeignKeyReference; rd1.RelationKeys.Add("id", "id"); rd.ChildTableDescriptor.Relations.Add(rd1);


AD Administrator Syncfusion Team October 21, 2005 08:18 PM UTC

Well I am going to answer my own question, feel free to correct me if I am way off:) Using the GridRecord I just get the value of the mapping tables id value as an array and iterate thru the values. so... Array array = rec.GetValue("BaseTable_ChildTable_id") as Array;

Loader.
Up arrow icon