sample code for faq page asp.net c#
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Dim db As New AccreditationDataContext
Dim group = From g In db.FaqGroups _
Order By g.Name _
Select g
For Each gr In group
Dim gId As Integer = gr.ID
Dim ac As New Accordion
Dim litDivS As New LiteralControl
litDivS.Text = "<br /><div class=faqHeaderDiv>"
Dim litDivE As New LiteralControl
litDivE.Text = "</div>"
Dim litGroup As New LiteralControl
litGroup.Text = gr.Name
ac.ID = "accord" + gr.ID.ToString()
ac.HeaderCssClass = "accordionFaqHeader"
ac.ContentCssClass = "accordionFaqContent"
ac.TransitionDuration = 250
ac.FadeTransitions = True
ac.RequireOpenedPane = False
ac.SelectedIndex = -1
Dim quest = From q In db.Faqs _
Order By q.Question _
Where q.GroupID = gId _
Select q
For Each qu In quest
Dim ap As New AccordionPane
ap.EnableViewState = True
ap.ID = qu.ID
Dim litHeader As New LiteralControl
litHeader.ID = "lblHeader" + qu.ID.ToString()
litHeader.Text = qu.Question
ap.HeaderContainer.Controls.Add(litHeader)
Dim litContent As New LiteralControl
litContent.ID = "lblContent" + qu.ID.ToString()
litContent.Text = qu.Answer + "<br /><br />"
ap.ContentContainer.Controls.Add(litContent)
ac.Panes.Add(ap)
Next
PlaceHolder1.Controls.Add(litDivS)
PlaceHolder1.Controls.Add(litGroup)
PlaceHolder1.Controls.Add(litDivE)
PlaceHolder1.Controls.Add(ac)
Next
End If
End Sub