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

Create/Edit hierarchical data in Grid - Help

Hello,

Is possible create hierarchical data in Grid without one data collection loaded for levels (parents and childs), only with code? How?
My application need create/edit the hierarchical data in runtime, like select one cell (first column) in Grid and click in "Expand Selected column" (like Excel).

Thanks for all help.

For example, see my attached image.



imagemx_70152fab.zip

3 Replies

NA Nisha Arockiya A Syncfusion Team November 11, 2008 11:09 AM UTC

Hi Rossa,

Thanks for your interest in Syncfusion Products.

Hierarchical Data can be created by defining relation between Parent and Child Datatable.Please refer to the code snippet below.

DataTable parentTable = GetParentTable();
DataTable childTable = GetChildTable();
DataSet ds = new DataSet();
ds.Tables.AddRange(new DataTable[] { parentTable, childTable });
ds.Relations.Add(new DataRelation("ParentToChild", ds.Tables[0].Columns["parentID"], ds.Tables[1].Columns["ParentID"]));
this.gridGroupingControl1.DataSource = parentTable;


Here is a minimal sample:
http://websamples.syncfusion.com/samples/Grid.Windows/Development/GGC_Hierarchy_F77551.zip

Please let me know if this is your requirement or am I missing any thing??

Regards,
Nisha




AD Administrator Syncfusion Team November 11, 2008 11:44 AM UTC

Hi Nisha,

Thanks for you reply, in my case I need create (layout) hierarchical data in runtime (virtual mode), where all "relations" (only layout) are created on demand.
Why? My collection not contain relations with data fields, not contain data fields keys, only has relation "parent-childs" defined on demand.
I found in Syncfusion Samples (.Net Win Forms) the application "VirtTree Grid", it's basically I need.

I codified some applications like this sample found, I write my questions in soon.

Thanks




NA Nisha Arockiya A Syncfusion Team November 17, 2008 06:32 AM UTC

Hi Rossa,

Thanks for the updates.

We are waiting to hear from you.

Regards,
Nisha


Loader.
Live Chat Icon For mobile
Up arrow icon