开发者

Easiest way to convert IGrouping to IHierarchicalDataSource

I have a list of business objects that I want to display in a menu. I can quickly use LINQ to created nested groups to match the desired structure but have to manually iterate th开发者_运维知识库rough each to instantiate and populate the menu items. I'm using the DevExpress ASPxMenu which supports IHierarchicalDataSource and IHierarchicalEnumerable. What's the easiest way for me to create convert my grouped list (as IGrouping) into one of these interfaces?


I had to do something similar for a hierarchical list from a database to display in a tree control. What I ended up doing was using LINQ2XML to create XElements as necessary to model the hierarchy, and then passing the top element to the tree control.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜