开发者

jQuery / asp.net-mvc: How can I display Hierarchical Data using IHierarchicalEnumerable?

I have an asp.net backend that creates Hierarchical Data based on IHierarchicalEnumerable.

This was used for custom Hierarchical Data Controls in ASP.NET WebForms for sitemaps etc. We are now using ASP.NET MVC and am looking to use the same Hierarchical Data Collection with jQuery / Json etc.

How can I display Hierarchical Data using IHierarchicalEnumerable?

Is it possible (or a good idea) to return the IHierarchicalEnumerable as a JsonResult and iterate through this jQuery or should we just itera开发者_Python百科te through this within the view? Any Ideas on which one is better and how to do this?

Added:

Ideally we want to render say a treeview via Json/Ajax, so that would need to be a jQuery recursive approach if the object (IHierarchicalEnumerable ) is supported, not sure how efficient this would be though. Thinking an alternative approach to IHierarchicalEnumerable might be worth investigating...


To keep things simple in this case (which in fact only requires a 2 level hierarchy) I have just used a basic Model that contains a list of sub-items...

Will asnwer it for now and may come back to it when I do a full nested hierarchy for treeview etc...

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜