views:

56

answers:

1

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

A: 

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

Mark Redman