Here in this example, I am going to show you how to create Nested Gridview with Expand and Collapse Functionality.
I have used java script to add the expandable and collapsible functionality in nested gridview by displaying plus and minus image. I have used Subjects and SubjectUnits tables to populate the nested gridviews.
Drag and drop the Gridview control from toolbox and add two template fields with in <Columns> tag one as first column and one as last column of gridview. Now add SQLDataSource from toolbox and configure it. The HTML source will be look like as shown below-
Now, Write the following code on RowDataBound event of parent gridview to bind the child gridview with data.
Build the application and run it to test the functionality.