This is a migrated thread and some comments may be shown as answers.

RadGrid Hierarchy - Binding from DataTable

3 Answers 175 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jeffrey
Top achievements
Rank 1
Jeffrey asked on 16 Dec 2009, 02:15 AM
Hi, I'm facing some problems with the RadGridView hierarchy. Any help would be greatly appreciated.

1. Nested DataTable works, but anyway to do it without loading the data of all child tables?

The following is an XML representation of the structure for the DataTable object used:
<CustomerTable> 
  <Customer> 
    <Name>John</Name> 
    <Sex>Male</Sex> 
    <AccountTable> 
      <Account> 
        <AccountNo>0001</AccountNo> 
        <Status>Active</Status> 
      </Account> 
    </AccountTable> 
  </Customer> 
  <Customer> 
    <Name>Lily</Name> 
    <Sex>Female</Sex> 
    <AccountTable> 
      <Account> 
        <AccountNo>0002</AccountNo> 
        <Status>Active</Status> 
      </Account> 
      <Account> 
        <AccountNo>0003</AccountNo> 
        <Status>Terminated</Status> 
      </Account> 
    </AccountTable> 
  </Customer> 
</CustomerTable> 

I've managed to get the hierarchy to work using this DataTable object, but I would have to load the data of all child tables (in this case

the AccountTable) before binding to the ItemsSource of the RadGridView control. Is there anyway to load the child table data only when a row is expanded?
Also, for my case I cannot hard code the structure in class files  (ie: creating Customer and Account classes) as shown in the examples in the demo.

2. Is there an event fired when a row is expanded to display child tables  (ie: + sign clicked)?

3. Can anyone provide an example on how to use the BuildHierachyFromDataSet method in the RadGridView?

3 Answers, 1 is accepted

Sort by
0
Jeffrey
Top achievements
Rank 1
answered on 17 Dec 2009, 03:20 AM
I've managed to solve problem 1 and 2. Would be grateful to have an example for problem 3. Thanks.
0
Accepted
Vlad
Telerik team
answered on 17 Dec 2009, 09:15 AM
Hi Jeffrey,

 I've attached an example how to create hierarchy from DataSet.


Greetings,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Jeffrey
Top achievements
Rank 1
answered on 17 Dec 2009, 03:42 PM
Hi Vlad,

Thanks for the example.
Tags
GridView
Asked by
Jeffrey
Top achievements
Rank 1
Answers by
Jeffrey
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or