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.

Grouping Grid Child Elements, SourceListSet and Hierarchical DataSource

Thread ID:

Created:

Updated:

Platform:

Replies:

48391 Aug 25,2006 12:15 PM Aug 28,2006 07:57 AM Windows Forms 2
loading
Tags: Grouping
Administrator [Syncfusion]
Asked On August 25, 2006 12:15 PM

Hello,

I am binding hierarchical data sources (custom objects as well as DataSets with relationships) to a class inherited from the GridGroupingControl. I am having no problem in binding the source to the control, but I cannot determine how to get a reference to the different table controls and models that are now contained in the grid.

For example, I can use

base.TableControl

or

base.TableControl.Model

to get a reference to the top level parent elements. I have yet to find a method to retrieve the control and model references for the child elements. The only methods that are close to what I need are

base.GetTableControl()

or

base.GetTableModel()

These methods work well enough for direct access to a single child element (when the name is known) but I would like to be able to iterate all child elements and execute methods against the collection (adding handlers, etc.). I stumbled across the SourceListSet property, but I can''t determine when the information in the SourceListSet actually becomes available.

I''m trying to perform some custom routines immediately following the setting of a DataSource, so I''ve created the following property:

public new object DataSource
{
get
{
return base.DataSource;
}
set
{
base.DataSource = value;
// do something special
}
}

However, the SourceListSet isn''t populated immediately after setting the DataSource.

Any thoughts or ideas about how to loop through all elements, parent and children, in a dynamic fashion?

Administrator [Syncfusion]
Replied On August 28, 2006 06:28 AM

Hi John,

To iterate through all the nested/related table you can use the below code snippet.

Console.WriteLine( "Related Tables for " + this.gridGroupingControl1.Table.TableDescriptor.Name );
IterateRelatedTable( this.gridGroupingControl1.Table );

void IterateRelatedTable(Table table)
{
foreach(Table tb in table.RelatedTables)
{
Console.WriteLine( tb.TableDescriptor.Name );
if(tb.RelatedTables.Count > 0)
{
Console.WriteLine( "Related Tables for " + tb.TableDescriptor.Name );
IterateRelatedTable(tb);
}
}
}

Also refer to the Knowledge Base(KB) article link below, that helps in iterating through all the elements.

http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=360

Thanks,
Rajagopal


Administrator [Syncfusion]
Replied On August 28, 2006 07:57 AM

Hi Rajagopal,

That''s exactly what I was looking for. Thanks for your help!

>Hi John,

To iterate through all the nested/related table you can use the below code snippet.

Console.WriteLine( "Related Tables for " + this.gridGroupingControl1.Table.TableDescriptor.Name );
IterateRelatedTable( this.gridGroupingControl1.Table );

void IterateRelatedTable(Table table)
{
foreach(Table tb in table.RelatedTables)
{
Console.WriteLine( tb.TableDescriptor.Name );
if(tb.RelatedTables.Count > 0)
{
Console.WriteLine( "Related Tables for " + tb.TableDescriptor.Name );
IterateRelatedTable(tb);
}
}
}

Also refer to the Knowledge Base(KB) article link below, that helps in iterating through all the elements.

http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=360

Thanks,
Rajagopal


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.

;