views:

267

answers:

2

Hi, the object of the game in this case is to use a Treeview with a sitemap provider - and implement using CSS. I'm guessing the way to do this is with the CSS adapter kit.

I've plugged in the adapters using the DLL implementation and there i get my basic treeview but it seems to pull in all sorts of js that lets me click on nodes and such. In my case I just want to display a hierarchy with nested UL and LI's. I dont want any js clicky clicky!!

Is there anyway to accomplish this without having to use a seperate adapter project and rewriting the code to transform/render the treeview?

I'm also open to other options with the goal being a simple hierarchy on a treeview/menu, and a breadcrumb, coming out of an XML file.

thanks!

+1  A: 

I would use a repeater as in this example taken from the asp.net data access tutorials:

<asp:Repeater runat="server" ID="menu" DataSourceID="SiteMapDataSource1">
    <ItemTemplate>
        <li>
            <asp:HyperLink runat="server"
             NavigateUrl='<%# Eval("Url") %>'>
             <%# Eval("Title") %></asp:HyperLink>

            <asp:Repeater runat="server"
             DataSource="<%# CType(Container.DataItem,
             SiteMapNode).ChildNodes %>">
                <HeaderTemplate>
                    <ul>
                </HeaderTemplate>

                <ItemTemplate>
                    <li>
                        <asp:HyperLink runat="server"
                         NavigateUrl='<%# Eval("Url") %>'>
                         <%# Eval("Title") %></asp:HyperLink>
                    </li>
                </ItemTemplate>

                <FooterTemplate>
                    </ul>
                </FooterTemplate>
            </asp:Repeater>
        </li>
    </ItemTemplate>
</asp:Repeater>

Here's a link to the whole article: Master Pages and Site Navigation

I forgot to mention, I would not use the css adapters, I've heard they're a pain.

Nathan Prather
A: 

The CSS adapters are provided as SAMPLE code. That's why they come in their own namespace and not in a System or Microsoft namespace. The idea is that you can customise them to suit your own needs.

If you don't need the Js, edit the code and remove it. Alternatively, use your own code instead.

Matt Lynch