开发者

Best practice for implementing Nested GridView up to 4 levels?

开发者 https://www.devze.com 2022-12-13 17:01 出处:网络
How do I implement nested gridview up to 4 levels? + Level 1 + Level 2A + Level 3A + Level 3B Level 4 + Level开发者_JAVA技巧 2B

How do I implement nested gridview up to 4 levels?

 + Level 1
   + Level 2A
      + Level 3A
      + Level 3B
          Level 4
   + Level开发者_JAVA技巧 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.


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. 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消