Get data from IEnumerable. Loop.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • shapper

    Get data from IEnumerable. Loop.

    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<Hie rarchyNode<MyTy pe>>

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