Results 1 to 2 of 2

Thread: Dynamic Accordion Menu

  1. #1
    Join Date
    Feb 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Dynamic Accordion Menu

    1) Accordion Menu script

    2) http://www.dynamicdrive.com/dynamici...ordionmenu.htm

    Having problems to populate my dynamic ASP.NET menu with the
    accordion menu.

    Here is my code:

    <%@ Control Language="C#" %>

    <%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>



    <script type="text/javascript" src="http://www.ergona.se/js/accordion/jquery-1.2.2.pack.js"></script>
    <script type="text/javascript" src="http://www.ergona.se/js/accordion/ddaccordion.js"></script>

    <script type="text/javascript">


    ddaccordion.init({
    headerclass: "expandable", //Shared CSS class name of headers group that are expandable
    contentclass: "categoryitems", //Shaared CSS class name of contents group
    collapseprev: true, //Collapse previous content (so only one open at any time)? true/false
    defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
    animatedefault: false, //Should contents open by default be animated into view?
    persiststate: true, //persist state of opened contents within browser session?
    toggleclass: ["", "openheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
    togglehtml: ["none", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively ["position", "html1", "html2"] (see docs)
    animatespeed: "normal" //speed of animation: "fast", "normal", or "slow"
    })


    </script>




    <img src="http://www.ergona.se/App_Themes/Ergona/images/hl_sortiment.png" alt="" width="143" height="32"/>



    <div class="arrowlistmenu">

    <%

    //Using the Site's static category collection (created in Global.asax OnAppStart)
    //showing only parent and direct child however feel free to use whatever makes
    //sense to you

    foreach (Commerce.Common.Category cat in CategoryController.CategoryList)
    {

    if (cat.ParentID == 0)
    {

    %>

    <div class="menuheader expandable">
    <a href="<%=Utility.GetRewriterUrl("catalog",cat.CategoryGUID.ToString() ,"")%>"><%=cat.CategoryName%></a>
    </div>




    <ul class="categoryitems">
    <%


    //get the kids
    foreach (Commerce.Common.Category subCat in CategoryController.CategoryList)
    {
    if (subCat.ParentID == cat.CategoryID)
    {

    %>


    <li>
    <a href="<%=Utility.GetRewriterUrl("catalog",subCat.CategoryGUID.ToString(),"")%>"><%=subCat.CategoryName%></a>
    </li>

    <%

    }
    }

    }
    }
    %>


    </ul>
    </div>

  2. #2
    Join Date
    Aug 2004
    Posts
    10,140
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    I don't know ASP, but in general, the checklist for using any server side language to dynamically output client side JavaScripts is the same. As long as what gets output to the browser conforms to the syntax/ conventions of the client side script, as if you've manually added it to the page, it should work.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •