Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
560
Create hierarchical grid using a flat source?
posted

Hello again,

 is it possible to create a hierarchical grid using a flat datasource? I have one datatable with parents and childs in it (returned from a sql statement) and would like to show data hierarchical in the grid. Maybe there is a way I could do this without recreating two datatables from the given one.

If it isn't possible, how would you prefer to get a dataet with parent and child table? I could do one stored procedure return two recordset (parent and child) and place the data in two datatables. Or I could split the data from one datatable back to two datatables..

Thanks, Stefan

Parents
No Data
Reply
  • 37774
    posted

    The grid cannot create the hierarchy itself; it relies on the relationships being defined in the data source.  If you're using a DataSet, you would have to create a relation that specifies how the parent-child relationship should work.  You don't need to split apart your data, you can have a recursive relationship on the same table.  You might want to set grid.DisplayLayout.MaxBandDepth to something small, though.

    -Matt

Children