I have a repeater control with which I'm using to build a top page menu from a sitemap datasource. I builds well alright but the menu item with child menu items doesn't close and I can't get to close. Actually I would prefer that the main menu item be clicked on to display the child menu items. Unfortunately, I can't get it done.

Here's my code;

          <div class="nav-collapse pull-right">
                <ul class="nav nav-pills">

                    <asp:Repeater runat="server" ID="Repeater1" DataSourceID="ApplicationSiteMap" OnItemDataBound="Repeater1_ItemDataBound">
                        <ItemTemplate>

                            <li class="">
                            <a id="A2" runat="server"  href='<%# DataBinder.Eval(Container.DataItem, "Url") %>' >
                                <%# DataBinder.Eval(Container.DataItem, "Title") %><%# ((Eval("ChildNodes") as SiteMapNodeCollection).Count > 0) ? "<b class='caret'></b>" : "" %>                                    
                            </a>                                                

                                <%#  ((Eval("ChildNodes") as SiteMapNodeCollection).Count > 0) ? GenerateNavNode(Eval("Url").ToString(),Eval("Title").ToString()) : "" %>

                                <asp:Repeater ID="Repeater2" runat="server" OnItemDataBound="Repeater2_ItemDataBound"
                                    DataSource='<%# DataBinder.Eval(Container.DataItem,"ChildNodes") %>'>
                                    <HeaderTemplate>

                                    </HeaderTemplate>
                                    <ItemTemplate>

                                        <a id="A1" runat="server" href='<%# DataBinder.Eval(Container.DataItem, "Url") %>'>
                                            <%# DataBinder.Eval(Container.DataItem, "Title") %></a>                                            
                                        <%#  ((Eval("ChildNodes") as SiteMapNodeCollection).Count > 0) ? GenerateNavNode(Eval("Url").ToString(),Eval("Title").ToString()) : "" %>
                                        <asp:Repeater ID="Repeater3" runat="server" OnItemDataBound="Repeater2_ItemDataBound"
                                    DataSource='<%# DataBinder.Eval(Container.DataItem,"ChildNodes") %>'>
                                    <ItemTemplate>
                                    <a id="A0" runat="server" href='<%# DataBinder.Eval(Container.DataItem, "Url") %>'>
                                            <%# DataBinder.Eval(Container.DataItem, "Title") %></a>                                            

                                    </ItemTemplate>
                                    </asp:Repeater>

                                    </ItemTemplate>
                                    <FooterTemplate>

                                    </FooterTemplate>
                                </asp:Repeater>

                                <%# ((Eval("ChildNodes") as SiteMapNodeCollection).Count > 0) ? "</li></ul>" : "" %>
                            </li>           
                        </ItemTemplate>
                    </asp:Repeater>
                </ul>
            </div>

A quick help will be very much appreciated.

Related posts

Recent Viewed