Sometimes it can be valuable to display hierarchy data in a grid. It can allow users to quickly drill down into the data at the click of a button. Below you will see a sample database with just three tables.
Notice that this is very elementary example, but it works well to demonstrate how easy it is to leverage hierarchy within the RadGridView control. I am using LINQToSQL to pull the data from the database. Below you will see the classes created after I did a drag and drop of the tables using Server Explorer in Visual Studio 2008.
Now I can add a new Window Form called "ClassInfo" to my project and drop a RadGridView onto to design surface. I set it the Dock property to Fill so you can see the grid appropriately. I added the following using statement to keep minimize my typing.
The Load event is where I will populate the grid and setup the hierarchy relationship within the RadGridView.
The end result is my grid will now display both the Teacher information and the Students that are in that Teachers classes. See below.
Nikolay Diyanov Diyanov is the Product Manager of the Native Mobile UI division at Progress. Delivering outstanding solutions that make developers' lives easier is his passion and the biggest reward in his work. In his spare time, Nikolay enjoys travelling around the world, hiking, sun-bathing and kite-surfing.
Subscribe to be the first to get our expert-written articles and tutorials for developers!