views:

67

answers:

4

How do I implement nested gridview up to 4 levels?

 + Level 1
   + Level 2A
      + Level 3A
      + Level 3B
          Level 4
   + Level 2B
A: 

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.

Kane
A: 

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.

Robert W
We need to do this without need for a third party components.
Ahmed
A: 

With an approach like this, performance will become an issue. Definitely not a good practice.

IrishChieftain
A: 

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

Eugene Niemand