How do I implement nested gridview up to 4 levels?
+ Level 1
+ Level 2A
+ Level 3A
+ Level 3B
Level 4
+ Level 2B
How do I implement nested gridview up to 4 levels?
+ Level 1
+ Level 2A
+ Level 3A
+ Level 3B
Level 4
+ Level 2B
I once had a bet with a colleague that I could write code using ASP.NET controls to display nested data (using either a Repeater or GridView) far easier than he could write the same code usign XSLT. Unfortunately for me I was wrong and the XSLT option proved far more flexible and scaleable.
So whilst not answering your question I would suggest that you have a look at using XSLT to provide the result. If I can find the code I will update this answer.
Personally I would question whether a Gridview is the most intuitive way to display such nested data - but if you have no other choice and don't mind paying for a third party component I would recommend at telerik's RAD Grid which supports nested tables very seamlessly.
Have a look at this demo in particular. This demo also explains the databinding structure.
With an approach like this, performance will become an issue. Definitely not a good practice.
I recently faced the same problem and developed my own implementation with Gridviews, Ajax and jQuery. so it only loads what is needed when its needed. I wrote an article over on my blog explaining step by step how to implement it and its actually quite simple. have a look here http://cli.gs/rBtzW