none
请问怎样用Accordion做一个动态导航。 RRS feed

答案

  • 你好,      

             你能尝试下面这样的配置,通过后台代码绑定数据到Accordion:

     <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    
    <ajaxToolkit:Accordion
       ID="Accordion1" runat="server" TransitionDuration="100" 
       FramesPerSecond="200" FadeTransitions="true" RequireOpenedPane="false" 
       OnItemDataBound="Accordion1_ItemDataBound"
       ContentCssClass="acc-content" HeaderCssClass="acc-header" 
       HeaderSelectedCssClass="acc-selected">
        <HeaderTemplate>
          <%#DataBinder.Eval(Container.DataItem,"categoryName") %>
        </HeaderTemplate>
        <ContentTemplate>
          <asp:HiddenField ID="txt_categoryID" runat="server" 
              Value='<%#DataBinder.Eval(Container.DataItem,"categoryID") %>' 
         />
       <asp:GridView ID="GridView1" runat="server" 
             RowStyle-BackColor="#ededed" RowStyle-HorizontalAlign="Left"
             AutoGenerateColumns="false" GridLines="None" CellPadding="2" 
             CellSpacing="2" Width="300px">
    <Columns>
       <asp:TemplateField 
           HeaderStyle-HorizontalAlign="Left" HeaderText="Product Name" 
           HeaderStyle-BackColor="#d1d1d1"
           HeaderStyle-ForeColor="#777777">
    
    <ItemTemplate>
      <%#DataBinder.Eval(Container.DataItem,"productName") %>
    </ItemTemplate>
    </asp:TemplateField>
    </Columns>
    </asp:GridView>
    </ContentTemplate>
    </ajaxToolkit:Accordion>

    请参考下面这些链接了解更多信息:

    Dynamically Load Data into Accordion Control using Code Behind Dataset

    http://www.codeproject.com/Articles/138764/Dynamically-Load-Data-into-Accordion-Control-using

    http://www.codeproject.com/Articles/82465/Creating-an-AJAX-Accordion-Menu


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • 已标记为答案 彭123 2014年4月18日 5:36
    2014年4月18日 3:16
    版主

全部回复

  • 就是类似这样的。怎样动态生成产品展示,行业管理等head按钮,然后里面又怎样动态生产要导航的按钮。

    我知道里面是使用A标记来导航,但是要怎样动态生成呢?

    2014年4月17日 4:49
  • 你好,      

             你能尝试下面这样的配置,通过后台代码绑定数据到Accordion:

     <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    
    <ajaxToolkit:Accordion
       ID="Accordion1" runat="server" TransitionDuration="100" 
       FramesPerSecond="200" FadeTransitions="true" RequireOpenedPane="false" 
       OnItemDataBound="Accordion1_ItemDataBound"
       ContentCssClass="acc-content" HeaderCssClass="acc-header" 
       HeaderSelectedCssClass="acc-selected">
        <HeaderTemplate>
          <%#DataBinder.Eval(Container.DataItem,"categoryName") %>
        </HeaderTemplate>
        <ContentTemplate>
          <asp:HiddenField ID="txt_categoryID" runat="server" 
              Value='<%#DataBinder.Eval(Container.DataItem,"categoryID") %>' 
         />
       <asp:GridView ID="GridView1" runat="server" 
             RowStyle-BackColor="#ededed" RowStyle-HorizontalAlign="Left"
             AutoGenerateColumns="false" GridLines="None" CellPadding="2" 
             CellSpacing="2" Width="300px">
    <Columns>
       <asp:TemplateField 
           HeaderStyle-HorizontalAlign="Left" HeaderText="Product Name" 
           HeaderStyle-BackColor="#d1d1d1"
           HeaderStyle-ForeColor="#777777">
    
    <ItemTemplate>
      <%#DataBinder.Eval(Container.DataItem,"productName") %>
    </ItemTemplate>
    </asp:TemplateField>
    </Columns>
    </asp:GridView>
    </ContentTemplate>
    </ajaxToolkit:Accordion>

    请参考下面这些链接了解更多信息:

    Dynamically Load Data into Accordion Control using Code Behind Dataset

    http://www.codeproject.com/Articles/138764/Dynamically-Load-Data-into-Accordion-Control-using

    http://www.codeproject.com/Articles/82465/Creating-an-AJAX-Accordion-Menu


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • 已标记为答案 彭123 2014年4月18日 5:36
    2014年4月18日 3:16
    版主