How do i do this in gridgrouping ccontrol
I have a Dataset with two tables
Table1
ColumnA, Column B
Table2
ColumnB,Column C,Column D
There is a relation between Table1.ColumnB and Table2.ColumnB. I would like to group by Table1.ColumnA and display the data in hierachial view in gridgrouping control
AD
Administrator
Syncfusion Team
July 7, 2006 07:59 PM UTC
Hi Shankar,
Try this code snippet to add the grouped columns in a grouping grid. Here is a code snippet.
this.gridGroupingControl1.ShowGroupDropArea = true;
GridTableDescriptor gdr = this.gridGroupingControl1.GetTableDescriptor("Table1");
gdr.GroupedColumns.Add("ColumnA",ListSortDirection.Ascending);
Let me know if this helps.
Best Regards,
Haneef
SR
Shankar Ramasubramanian
July 7, 2006 08:14 PM UTC
It didn''t work. runtime error. gdr is null
DataSet newDs = new DataSet();
newDs.ReadXml("c:\\Shankar\\Group1.xml");
this.gridAttributes.ShowGroupDropArea = true;
gridAttributes.DataSource = newDs.Tables[0];
GridTableDescriptor gdr = this.gridAttributes.GetTableDescriptor("Table1");
gdr.GroupedColumns.Add("Columna", ListSortDirection.Ascending);
AD
Administrator
Syncfusion Team
July 7, 2006 08:22 PM UTC
Hi Shankar,
The reason is that you are misspelled the table name. In general, GetTableDescriptor method takes the table name as the argument. can you please double check your DataTable name?. Let me know if i am missing something.
Try this code:
GridTableDescriptor gdr = this.gridGroupingControl1.GetTableDescriptor(ds.Tables[0].TableName );
///Or
this.gridGroupingControl1.TableDescriptor.GroupedColumns.Add("ColumnA",ListSortDirection.Ascending);
Best Regards,
Haneef