1
Answer

Making a treeview with ul and li

Andre

Andre

17y
4.1k
1

Hi everyone,

I want to make a treeview with data from the Indexing Service. I have configured everything but now I got the following problem:

I get an Array with data back from the Indexing Service.

For example:

Item[0]
-Children[0]
-Children[1]

Every Child has also a child and can be 5 or 6 childs deep.

For example:

Item[0].Children[0].Children[1].Children[2].Children[3].Children[4]

Now I would like to make a treeview with <ul> and <li>

For example:

<lu>
    <li>Item[0].Name
        <ul>
            <li>Item[0].Children[0].Name
                <lu>
                     <li>Item[0].Children[0].Children[1].Name
                     </li>
                </lu>
            </li>
            <li>Item[0].Children[1].Name
                <lu>
                     <li>Item[0].Children[1].Children[1].Name
                     </li>
                </lu>
            </li>
        </lu>
    </li>
    <li>Item[1].Name
        <ul>
            <li>Item[1].Children[0].Name
                <lu>
                     <li>Item[1].Children[0].Children[1].Name
                     </li>
                </lu>
            </li>
            <li>Item[1].Children[1].Name
                <lu>
                     <li>Item[1].Children[1].Children[1].Name
                     </li>
                </lu>
            </li>
        </lu>
    </li>
</lu>

How can I generate this in a WebCustomControl?

Can someone help me out with this?


Answers (1)