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

Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source