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
475
Wingrid with Parent and Child row using IList
posted

Dear All,

I have a grid which uses an IList<T> as the datasource. In the IList, i have a columns like IncidentID and ParentIncidentID. Internally the relationship is assumed like If ParentIncidentID = 0 then it is a parent data, and if the ParentIncidentID != <incidentID#> then it is a child data of some incindent. I Want to bind all the parent data in band(0) and the child data in bands(1) by creating the relationship.

Sample Data

 

Incident ID            ParentIncidentID    createdOn

1                              0                               4/12/2009

2                              0                              4/12/2009

3                              1                              4/12/2009

 

So my output should like the ID 1 should be with a + symbol and when I click it should show the Id 3 data.

Any help on this would be greatly appreciated.

Thanks,

Arun.K.S

 

Parents
No Data
Reply
  • 469350
    Suggested Answer
    Offline posted

    Hi Arun,

    There's no way to create a relationship within the grid, it has to exist in the data source. In this case, your data source is an IList, which doesn't support relationships, but it does support hierarchical data.

    To get this to work with a List<T>, your class 'T' would have to have a public property that exposes a List<T> of child rows.

    Another option you might consider is using an UltraDataSource. You could set up the UltraDataSource with the hierarchical structure you want and then bind it to the grid in virtual mode. In this mode, then UDS will fire events when it needs data and you could get that data from your lists, building the relationship on the fly, so to speak.

Children
No Data