Repeat AccordionPane

Last post 12-31-2007 11:00 AM by Gjoll. 2 replies.

Sort Posts:

  • Repeat AccordionPane

    12-31-2007, 7:56 AM
    • Member
      point Member
    • Gjoll
    • Member since 12-31-2007, 7:43 AM
    • Posts 2

    Hi,

    I'm creating a blog with the Accordion Control. That means that the content of the accordion control must be dynamic, I want to create the accordionpane controls on the flow but the accordion control can't work placeholders. I'll explain beter with some code

     

    This is the userControl News:

      

    1    <ajaxToolkit:AccordionPane ID="AccordionPane1" runat="server">
    2        <Header>
    3            <a href="#" class="accordionLink"><%=Name %></a>
    4        </Header>
    5        <Content>
    6            <ul>
    7                <li>Name: <%=Name %></li>
    8           </ul>
    9       </Content>
    10   </ajaxToolkit:AccordionPane>
    

     

    This is news.aspx (here must the accordion be created)
     

    1            <ajaxToolkit:Accordion ID="MyAccordion" runat="server" SelectedIndex="0" HeaderCssClass="accordionHeader" HeaderSelectedCssClass="accordionHeaderSelected" ContentCssClass="accordionContent" FadeTransitions="false" FramesPerSecond="40" TransitionDuration="250" AutoSize="None" RequireOpenedPane="false" SuppressHeaderPostbacks="true">
    2 <Panes>
    3 <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
    4 </Panes>
    5 </ajaxToolkit:Accordion>
      This is a part of the source code of the News.aspx (in this part i generate all the accordionpanes to print)
    1            foreach (News b in this.News) {
    2 Controls_UC_News x = (Controls_UC_News)LoadControl("~/Controls/UC_News.ascx");
    3 x.Name = b.Naam;
    4 PlaceHolder1.Controls.Add(x);
    5 }
     
    The problem is that Accordion can't work with the PlaceHolder... Is there any other way to fix this problem and to make it possible to repeat things on the accordion? 
    Thanks in advance! 
  • Re: Repeat AccordionPane

    12-31-2007, 9:04 AM
    • Member
      45 point Member
    • Senthrax
    • Member since 04-02-2007, 2:08 PM
    • Posts 82

     Look at this:
    http://forums.asp.net/t/1196563.aspx

    it shows how to databind an accordion.

    BTW, you realize you have your topic set to resolved? people will think the problem is already solved while its not.... 

  • Re: Repeat AccordionPane

    12-31-2007, 11:00 AM
    • Member
      point Member
    • Gjoll
    • Member since 12-31-2007, 7:43 AM
    • Posts 2

    Aha, nice! This works! Great ;-)

     Happy newyear!
     

Page 1 of 1 (3 items)