asp.net中嵌套菜单的逻辑

时间:2014-10-15 08:19:27

标签: jquery css asp.net webforms nested

我在下面显示了一些像这样的数据表;

ItemID         MENU                ParentID    ImgUrl   
----------- -------------------- ----------- -----------
1           Home                    0                   
2           Products                0                   
3           Categories              0                   
5           Products 1              2                   
6           Products 2              2                   
7           Products 3              2   
8           Products 2 1            6  
9           Categories  1           3           img1.jpg
10          Categories  2           3           img2.jpg

如何使用它们创建嵌套菜单:http://www.keenthemes.com/preview/metronic/theme/templates/frontend/shop-index.html

<!-- BEGIN NAVIGATION -->
<div class="header-navigation">
    <ul>
        <li class="dropdown">
            <a class="dropdown-toggle" data-toggle="dropdown" data-target="#" href="#">Woman</a>

            <!-- BEGIN DROPDOWN MENU -->
            <ul class="dropdown-menu">
                <li class="dropdown-submenu">
                    <a href="shop-product-list.html">Hi Tops <i class="fa fa-angle-right"></i></a>
                    <ul class="dropdown-menu" role="menu">
                        <li><a href="shop-product-list.html">Second Level Link</a></li>
                        <li><a href="shop-product-list.html">Second Level Link</a></li>
                        <li class="dropdown-submenu">
                            <a class="dropdown-toggle" data-toggle="dropdown" data-target="#" href="#">Second Level Link 

                                <i class="fa fa-angle-right"></i>
                            </a>
                            <ul class="dropdown-menu">
                                <li><a href="shop-product-list.html">Third Level Link</a></li>
                                <li><a href="shop-product-list.html">Third Level Link</a></li>
                                <li><a href="shop-product-list.html">Third Level Link</a></li>
                            </ul>
                        </li>
                    </ul>
                </li>
                <li><a href="shop-product-list.html">Running Shoes</a></li>
                <li><a href="shop-product-list.html">Jackets and Coats</a></li>
            </ul>
            <!-- END DROPDOWN MENU -->
        </li>
        <li class="dropdown dropdown-megamenu">
            <a class="dropdown-toggle" data-toggle="dropdown" data-target="#" href="#">Man </a>
            <ul class="dropdown-menu">
                <li>
                    <div class="header-navigation-content">
                        <div class="row">                         
                            <div class="col-md-4 header-navigation-col">
                                <h4>Clothing</h4>
                                <ul>
                                    <li><a href="shop-product-list.html">Base Layer</a></li>
                                    <li><a href="shop-product-list.html">Character</a></li>
                                    <li><a href="shop-product-list.html">Chinos</a></li>
                                    <li><a href="shop-product-list.html">Combats</a></li>
                                    <li><a href="shop-product-list.html">Cricket Clothing</a></li>
                                    <li><a href="shop-product-list.html">Fleeces</a></li>
                                    <li><a href="shop-product-list.html">Gilets</a></li>
                                    <li><a href="shop-product-list.html">Golf Tops</a></li>
                                </ul>
                            </div>
                            <div class="col-md-4 header-navigation-col">
                                <h4>Accessories</h4>
                                <ul>
                                    <li><a href="shop-product-list.html">Belts</a></li>
                                    <li><a href="shop-product-list.html">Caps</a></li>
                                    <li><a href="shop-product-list.html">Gloves, Hats and Scarves</a></li>
                                </ul>

                                <h4>Clearance</h4>
                                <ul>
                                    <li><a href="shop-product-list.html">Jackets</a></li>
                                    <li><a href="shop-product-list.html">Bottoms</a></li>
                                </ul>
                            </div>
                            <div class="col-md-12 nav-brands">
                                <ul>
                                    <li><a href="shop-product-list.html">
                                        <img title="esprit" alt="esprit" src="../../assets/frontend/pages/img/brands/esprit.jpg"></a></li>
                                    <li><a href="shop-product-list.html">
                                        <img title="gap" alt="gap" src="../../assets/frontend/pages/img/brands/gap.jpg"></a></li>
                                    <li><a href="shop-product-list.html">
                                        <img title="next" alt="next" src="../../assets/frontend/pages/img/brands/next.jpg"></a></li>
                                    <li><a href="shop-product-list.html">
                                        <img title="puma" alt="puma" src="../../assets/frontend/pages/img/brands/puma.jpg"></a></li>
                                    <li><a href="shop-product-list.html">
                                        <img title="zara" alt="zara" src="../../assets/frontend/pages/img/brands/zara.jpg"></a></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </li>
            </ul>
        </li>
        <li><a href="shop-item.html">Kids</a></li>
        <li class="dropdown dropdown100 nav-catalogue">
            <a class="dropdown-toggle" data-toggle="dropdown" data-target="#" href="#">New

  </a>
            <ul class="dropdown-menu">
                <li>
                    <div class="header-navigation-content">
                        <div class="row">
                            <div class="col-md-3 col-sm-4 col-xs-6">
                                <div class="product-item">
                                    <div class="pi-img-wrapper">
                                        <a href="shop-item.html">
                                            <img src="../../assets/frontend/pages/img/products/model4.jpg" class="img-responsive" alt="Berry Lace Dress"></a>
                                    </div>
                                    <h3><a href="shop-item.html">Berry Lace Dress</a></h3>
                                    <div class="pi-price">$29.00</div>
                                    <a href="#" class="btn btn-default add2cart">Add to cart</a>
                                </div>
                            </div>
                            <div class="col-md-3 col-sm-4 col-xs-6">                        
                                <div class="product-item">
                                    <div class="pi-img-wrapper">
                                        <a href="shop-item.html">
                                            <img src="../../assets/frontend/pages/img/products/model3.jpg" class="img-responsive" alt="Berry Lace Dress"></a>
                                    </div>
                                    <h3><a href="shop-item.html">Berry Lace Dress</a></h3>
                                    <div class="pi-price">$29.00</div>
                                    <a href="#" class="btn btn-default add2cart">Add to cart</a>
                                </div>
                            </div>                         
                        </div>
                    </div>
                </li>
            </ul>
        </li>
        <li class="dropdown">
            <a class="dropdown-toggle" data-toggle="dropdown" data-target="#" href="#">Pages 

  </a>

            <ul class="dropdown-menu">
                <li class="active"><a href="shop-index.html">Home Default</a></li>
                <li><a href="shop-index-header-fix.html">Home Header Fixed</a></li>
                <li><a href="shop-index-light-footer.html">Home Light Footer</a></li>
                <li><a href="shop-product-list.html">Product List</a></li>
                <li><a href="shop-search-result.html">Search Result</a></li>
                <li><a href="shop-item.html">Product Page</a></li>
                <li><a href="shop-shopping-cart-null.html">Shopping Cart (Null Cart)</a></li>
                <li><a href="shop-shopping-cart.html">Shopping Cart</a></li>
                <li><a href="shop-checkout.html">Checkout</a></li>
                <li><a href="shop-about.html">About</a></li>
                <li><a href="shop-contacts.html">Contacts</a></li>
                <li><a href="shop-account.html">My account</a></li>
                <li><a href="shop-wishlist.html">My Wish List</a></li>
                <li><a href="shop-goods-compare.html">Product Comparison</a></li>
                <li><a href="shop-standart-forms.html">Standart Forms</a></li>
                <li><a href="shop-faq.html">FAQ</a></li>
                <li><a href="shop-privacy-policy.html">Privacy Policy</a></li>
                <li><a href="shop-terms-conditions-page.html">Terms &amp; Conditions</a></li>
            </ul>
        </li>
        <li><a href="index.html" target="_blank">Corporate</a></li>

    </ul>
</div>
<!-- END NAVIGATION -->

我有这个主题,我必须填写菜单,如女性和男性类别,无尽的嵌套ul&gt; li菜单,如果子菜单项有图像,它将显示。

我无法用asp转发器填充它们,并且像废话一样。

最好的方法是什么?

1 个答案:

答案 0 :(得分:0)

这必须使用具有子控件数组的控件来完成。例如,如果您可以自定义UI,TreeView就很好。如果您选择转发器,则必须使用代码,而不是来自aspx代码,并将子链接动态添加为RepeaterItem。