aguywonderer
New member
- Joined
- Jun 15, 2005
- Messages
- 2
- Programming Experience
- Beginner
I created a quiz and used a panel control for dynamic loading. It works well only that I would like to 3 questions appear at a time and then move on to the next three with a next button and have DONE button on the last 3 questions. My code is below -- can anyone fill in the blanks or lead me in the right direction?
DBCommand = New OleDbDataAdapter _
("Select SectionName from CourseSections Where " _
& "CourseID = " & Session("CourseID"), DBConn)
DBCommand.Fill(DSPageData, "SectionName")
lblTitle.Text = "<center> " _
& DSPageData.Tables("SectionName").Rows(0).Item("SectionName") _
& "</center>"
DBCommand = New OleDbDataAdapter _
("Select SectionQuestionID, QuestionText " _
& "From SectionQuestions Where CourseID = " _
& Session("CourseID"), DBConn)
DBCommand.Fill(DSPageData, "QuizQuestions")
For I = 0 To DSPageData.Tables("QuizQuestions").Rows.Count - 1
Dim lcHTML = New LiteralControl
lcHTML.Text = "<b><br>" _
& DSPageData.Tables("QuizQuestions").Rows(I).Item("QuestionText") & "</b><br>"
pnlQuestions.Controls.Add(lcHTML)
Dim MyDDL = New RadioButtonList
TempID = DSPageData.Tables("QuizQuestions").Rows(I).Item("SectionQuestionID")
MyDDL.ID = "Q" & TempID
DBCommand = New OleDbDataAdapter _
("Select AnswerText " _
& "From QuestionAnswers Where SectionQuestionID = " _
& TempID, DBConn)
DBCommand.Fill(DSPageData, TempID)
For J = 0 To DSPageData.Tables(TempID).Rows.Count - 1
Dim MyItem = New ListItem
MyItem.Text = DSPageData.Tables(TempID).Rows(J).Item("AnswerText")
MyDDL.Items.Add(MyItem)
Next
pnlQuestions.Controls.Add(MyDDL)
Dim lcHTML2 = New LiteralControl
lcHTML2.Text = "<br><br>"
pnlQuestions.Controls.Add(lcHTML2)
Next
DBCommand = New OleDbDataAdapter _
("Select SectionName from CourseSections Where " _
& "CourseID = " & Session("CourseID"), DBConn)
DBCommand.Fill(DSPageData, "SectionName")
lblTitle.Text = "<center> " _
& DSPageData.Tables("SectionName").Rows(0).Item("SectionName") _
& "</center>"
DBCommand = New OleDbDataAdapter _
("Select SectionQuestionID, QuestionText " _
& "From SectionQuestions Where CourseID = " _
& Session("CourseID"), DBConn)
DBCommand.Fill(DSPageData, "QuizQuestions")
For I = 0 To DSPageData.Tables("QuizQuestions").Rows.Count - 1
Dim lcHTML = New LiteralControl
lcHTML.Text = "<b><br>" _
& DSPageData.Tables("QuizQuestions").Rows(I).Item("QuestionText") & "</b><br>"
pnlQuestions.Controls.Add(lcHTML)
Dim MyDDL = New RadioButtonList
TempID = DSPageData.Tables("QuizQuestions").Rows(I).Item("SectionQuestionID")
MyDDL.ID = "Q" & TempID
DBCommand = New OleDbDataAdapter _
("Select AnswerText " _
& "From QuestionAnswers Where SectionQuestionID = " _
& TempID, DBConn)
DBCommand.Fill(DSPageData, TempID)
For J = 0 To DSPageData.Tables(TempID).Rows.Count - 1
Dim MyItem = New ListItem
MyItem.Text = DSPageData.Tables(TempID).Rows(J).Item("AnswerText")
MyDDL.Items.Add(MyItem)
Next
pnlQuestions.Controls.Add(MyDDL)
Dim lcHTML2 = New LiteralControl
lcHTML2.Text = "<br><br>"
pnlQuestions.Controls.Add(lcHTML2)
Next