Guys,

I have a page that is working great using an accordion control with listviews as items. But I now have to take this back to .net 3.0, so no ListView. Can anybody help me do this please? I havent really used the repeater before...

Some code below. You can see that I am reading from an XML file of sections, each section has questions. My listviews actually hold instances of a custom control for each question, the CustomControl has properties that match the fields required in each question.

So, I need to use the repeater control to host the custom controls and get the data fomr the XML in there. The databind was easy on the listview...

Hope that makes sense...

Bob


Accordion Data bind event...
Code:
    Protected Sub accMain_ItemDataBound(ByVal sender As Object, ByVal e As AccordionItemEventArgs)
        Dim itemIndex As Integer = e.ItemIndex
        Dim itemType As AccordionItemType = e.ItemType

        If itemType = AccordionItemType.Content Then

            'This gets the questions with any completed data.
            Dim document As XDocument = XDocument.Load(Session("str_XMLDataFile"))

            Dim sectionName As String = XPathBinder.Eval(DataBinder.GetDataItem(e.AccordionItem), "@SectionName").ToString()

            Dim questions = From question In document.Descendants("Question") _
                            Where question.Parent.Attribute("SectionName").Value = sectionName _
                            Select Text = question.Element("Text").Value, _
                                Comment = question.Element("Comment").Value, _
                                VDSCode = question.Element("VDSCode").Value, _
                                Category = question.Element("Category").Value, _
                                YesNo = question.Element("YesNo").Value

            Dim lstQuestions As ListView = TryCast(e.AccordionItem.FindControl("lstQuestions"), ListView)
            lstQuestions.DataSource = questions
            lstQuestions.DataBind()
        End If


    End Sub

And the HTML for the accordion control, with the listview...
HTML Code:
                   <cc1:Accordion ID="accMain" runat="server" AutoSize="None" FadeTransitions="true" TransitionDuration="200" FramesPerSecond="40" RequireOpenedPane="false" SuppressHeaderPostbacks="true" DataSourceID="xmlDataSourceSections" onitemdatabound="accMain_ItemDataBound">
                                
                       <HeaderTemplate>
                            <asp:Label ID="SectionNameLabel" runat="server" Font-Bold="true" Font-Size="Larger" 
                                Text='<%# (Container.DisplayIndex + 1).ToString() + ".&nbsp;" + XPath("@SectionName")%>' />
                       </HeaderTemplate>
                        
                       <ContentTemplate>
                            <%--The content template for the Accordion Template which is a ListView--%>
                            
                            <%--field headings--%>
                            <asp:Label ID="Label6" runat="server" Font-Bold="True" Font-Underline="True" ForeColor="#006600" Width="260px"></asp:Label>
                            <asp:Label ID="Label2" runat="server" Font-Bold="True" Font-Underline="True" ForeColor="#006600" Text="Yes / No" Width="70px"></asp:Label>
                            <asp:Label ID="Label3" runat="server" Font-Bold="True" Font-Underline="True" ForeColor="#006600" Text="Category" Width="70px"></asp:Label>
                            <asp:Label ID="Label4" runat="server" Font-Bold="True" Font-Underline="True" ForeColor="#006600" Text="VDS Code" Width="90px"></asp:Label>
                            <asp:Label ID="Label5" runat="server" Font-Bold="True" Font-Underline="True" ForeColor="#006600" Text="Comment" Width="800px"></asp:Label>
                            <br />

                            <asp:ListView ID="lstQuestions" runat="server"> 
                    
                                <ItemTemplate>           
                                    <%--call the QuestionControl--%>                     
                                    <Custom:QuestionControl runat="server" ID="customControl" QCategory='<%#Eval("Category") %>' QVDSCode='<%#Eval("VDSCode") %>' QYesno='<%#Eval("YesNo") %>' QComment='<%#Eval("Comment") %>' QText='<%#Eval("Text") %>' />
                                    <br />
                                    <br />
                                </ItemTemplate>
                                                   
                                <LayoutTemplate>
                                    <div ID="itemPlaceholderContainer" runat="server">
                                        <span ID="itemPlaceholder" runat="server"/>                        
                                    </div>
                                </LayoutTemplate>
                            
                            </asp:ListView>
                    
                    <%--End of Accordion content Template--%>
                      </ContentTemplate>
            
                    </cc1:Accordion>