It is quite often that different customers eventually face the need to use a master-detail hierarchical representation of their data. However most customers are not aware that this is extremely easily achievable using Telerik OpenAccess ORM together with our RadGrid. Furthermore it is achieved without writing ANY code in the code behind file of your project.
Now let’s get to the job!
What will be needed is just one RadGrid and two OpenAccessDataSource controls. The two data source controls will be used to query data from the master and detail tables. In our case we used the Company and Employee tables(one company has many employees).
As you can see the first one queries all objects from the Company table. The second one returns only those employee that match the selected company id. This id is obtained with a session parameter. Now let’s define our grid. First we will need to bind the MasterTableView of the grid to the first data source as we want all the company objects to be displayed there. Then we need to bind the second data source to the details table of the grid in order to be displayed for each company. Here is how it is done:
We have defined some animations for expanding and collapsing as well, and now RadGrid looks quite “slick”.
I hope you enjoyed this example as much as I did writing it.
Copyright © 2016, Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.