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.

Adding child group at runtime

Thread ID:

Created:

Updated:

Platform:

Replies:

55944 Feb 7,2007 08:06 AM Feb 7,2007 01:30 PM Windows Forms 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On February 7, 2007 08:06 AM

Hi,

I have bind the collection to the grid grouping control with 3 grouping columns.
Now I have to add a one more group below the third group having all columns same as binded datasource but data for the group4 is coming from different datasource i.e second collection.
Can this possible in grid grouping control.

In short i need to add child table same like we add in relation of master detail....but i dont want it as a seperate child grid....i want that should be the part of same grid as columns are same but my data source is different

Please help urgently

Administrator [Syncfusion]
Replied On February 7, 2007 01:30 PM

Hi,

You can add UnBoundFieldDescriptor for the columns that you want to dynamically change from either table to the grid. Then make one table the grid’s datasource and use .QueryValue event to dynamically provide the values from the other table. If you want to handle editing, you would also have to handle SaveValue event.

this.gridGroupingControl1.TableDescriptor.UnboundFields.Add("TableColumnTwo0");
this.gridGroupingControl1.TableDescriptor.UnboundFields.Add("TableColumnTwo1");
this.gridGroupingControl1.TableDescriptor.UnboundFields.Add("TableColumnTwo2");

//Used for saving/Editing the data in the filed.
private void gridGroupingControl1_SaveValue(object sender, FieldValueEventArgs e)
{
GridTable table = this.gridGroupingControl1.GetTable(e.TableDescriptor.Name);
int iRecordIndex = table.UnsortedRecords.IndexOf(e.Record);
string sColumnName = e.Field.Name;
table2.Rows[iRecordIndex][sColumnName] = e.Value;
}

//For display purpose....
private void gridGroupingControl1_QueryValue(object sender, FieldValueEventArgs e)
{
GridTable table = this.gridGroupingControl1.GetTable(e.TableDescriptor.Name);
int iRecordIndex = table.UnsortedRecords.IndexOf(e.Record);
string sColumnName = e.Field.Name;
e.Value = table2.Rows[iRecordIndex][sColumnName];
}

Please refer the sample for implementation.
CombineTables.zip

Best Regards,
Haneef

Notes :

Table1 => ID,Name,Rate
Table2 =>TableColumnTwo0,TableColumnTwo1,TableColumnTwo2

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.

;