By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,451 Members | 1,588 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,451 IT Pros & Developers. It's quick & easy.

Get data from IEnumerable. Loop.

P: n/a
Hello,

I found really useful Hierarchy extension (http://www.scip.be/
index.php?Page=ArticlesNET18) which I am using to load the categories
hierarchic structure from an Adjacency Model table.

So with my Linq query I get an object of type
IEnumerable<HierarchyNode<MyType>>

The result can be used as a ItemSource of an Asp.Net tree view but
this is not what I need.

I am trying to create two things:

1. Create a SelectList.

Each item has a name and a value:
value = MyType.ID
name = N nbsp; + MyType.Name
(N nbsp; are added before the name. N = Node Depth
which is given in each Hierarchy Node)

2. Create a Unordered List (Just a string containing the code). Just
an example of how it would look:

<ul id="Categories">
<li>Root 1</span>
<ul>
<li>Child 11
<ul>
<li>Child 111</li>
<li>Child 112</li>
</ul>
</li>
<li>Child 12</li>
</ul>
</li>
<li>Root 2
<ul>
<li>Child 21</li>
</ul>
</li>
</ul>

Could someone, please, help me out in creating this loops?

Thanks,
Miguel
Jun 27 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.