0

I am trying to take a menu/sitemap object in vb.net and create a specific set of code to style, the menu code is pretty simple:

<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" SiteMapProvider="MySiteMap" />
<asp:Menu ID="Menu1" runat="server" CssClass="menu" DataSourceID="SiteMapDataSource1"
        EnableViewState="False" IncludeStyleBlock="False" StaticDisplayLevels="2" Orientation="Vertical"> </asp:Menu>

I would like to put it into the following structure, but can't seem to figure out how:

<li class="active">
                        <a href="index.html">
                            <span>First Menu Option</span>
                        </a>
                    </li>
                    <li>
                        <a href="1stMenuOption.html">
                            <span>Second Menu Option</span>
                        </a>
                    </li>
                    <li class="treeview">
                        <a href="#">
                            <span>3rd Menu Option with Sub-Menu</span>
                        </a>
                        <ul class="treeview-menu">
                            <li><a href="1stSubMenu.html">First Sub-Menu</a></li>
                            <li><a href="2ndSubMenu.html">Second Sub-Menu</a></li>
                            <li><a href="3rdSubMenu.html">Third Sub-Menu</a></li>
                        </ul>
                    </li>

I'm sure it has to be possible, just not sure what to do.

Andrew
  • 437
  • 7
  • 18
  • ASP.Net v4.0 onwards produces css-friendly markup by default. i.e. clean `ul`s and `li`s. – Abhitalks Nov 19 '14 at 06:17
  • I am using v4.0. It is relatively clean, I suppose. Do I have to work with the ID's and Classes it created and the exact structure or can i manipulate it somehow? It does not build the spans or any other elements I might want to put in there. – Andrew Nov 19 '14 at 06:25
  • Yes. View the source i.e. generated markup and identify the `id`s and classes. Develop your stylesheet based on that. If you want to change the generated markup, then you would have to extend the control on your own which IMO is not really worth it. – Abhitalks Nov 19 '14 at 06:28

0 Answers0