Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesAccordian problemAccordian problem
Previous
 
Next
New Post
2/21/2013 6:18 AM
 

Cheers guys, I was able to set up a repeater inside the accordian no problem but I would like to take this a little further and have nested accordians.
For example in an Faq module.
The category Title is used in first accordian and repeater.
I would now like to have a second nested accordian and repeater showing the questions and answers only for the selected category.
I have sort of got it working to a point by binding the second repeater in the parent repeaters item data bound event but wondering how and where to catch the parent selection to bind the child repeater and accordian.

Repeater HTML code .
<div id="FAQCAT" >
         <asp:Repeater ID="rptCategory" runat="server"
             onitemdatabound="rptCategory_ItemDataBound">
            <ItemTemplate>
             <h3 class="SJFM_accordionHeader"><a href="#"><%# DataBinder.Eval(Container.DataItem, "FAQ_CAT")%></a></h3>
              <div class="SJFM_accordionContent">
               
                    <div id="FAQ" >
                        <asp:Repeater ID="Repeater1" runat="server">
                            <ItemTemplate>
                                <h3 class="SJFM_accordionHeader"><a href="#"><%# DataBinder.Eval(Container.DataItem, "Question")%></a></h3>
                                <div class="SJFM_accordionContent">
                                    <p>
                                        <%# DataBinder.Eval(Container.DataItem, "Answer")%>
                                    </p>
                                </div>
                            </ItemTemplate>
                        </asp:Repeater>
                      </div>
            </div>
        </ItemTemplate>
        </asp:Repeater>
        </div>
Code behind
protected void rptCategory_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                 Repeater FaqList = (Repeater)e.Item.FindControl("Repeater1");
                if (FaqList != null)
                {   // now want to pass the category id to this but how and from where
                    FaqList.DataSource = SJFM_SQL1.FAQ();
                    FaqList.DataBind();
                  
                }
            }

        }

 
New Post
2/21/2013 7:58 AM
 
The dataitem being bound is in e.Item.DataItem (or similar).

Grab that, cast it to whatever your type your data entity is. Access the data.

Done!

Best wishes,
- Richard
Agile Development Consultant, Practitioner, and Trainer
www.dynamisys.co.uk
 
New Post
2/21/2013 11:01 AM
 

That worked,  in case anyone else is interested this is how you cast the dataitem.

string cat =  (string)DataBinder.Eval(e.Item.DataItem, "FAQ_CAT");
int ID = (int)DataBinder.Eval(e.Item.DataItem, "FAQ_CATID"); 

Many thanks Stuart

 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesAccordian problemAccordian problem


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out