hi..i'm doing my final year project on creating Questionnaires template. i have problem with viewing my OptionLIst. I have 2 dataset..all i want to do is to preview all my Question & Answer..i can view them, but i need to create textboxes or checkboxes besides the OptionList..
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
Dim questDA As SqlDataAdapter = New SqlDataAdapter("SELECT * FROM Question WHERE SurveyID=83", MyConnection)
Dim surveyDA As SqlDataAdapter = New SqlDataAdapter("SELECT * FROM AnswerList WHERE SurveyID=83", MyConnection)
Dim custDS As DataSet = New DataSet
questDA.Fill(custDS, "Question")
surveyDA.Fill(custDS, "AnswerList")
MyConnection.Close()
Dim custAnswerListrel As DataRelation = custDS.Relations.Add("CustAnswerList", _
custDS.Tables("Question").Columns("QuestionID"), _
custDS.Tables("AnswerList").Columns("QuestionID"))
Dim pRow, cRow As DataRow
Dim radlist As New RadioButtonList
For Each pRow In custDS.Tables("Question").Rows
Response.Write("<br>")
'Response.Write(pRow("QuestionID").ToString())
Response.Write(pRow("QuestionNum").ToString())
Response.Write(pRow("Question").ToString())
Response.Write("<br>")
Response.Write(pRow("QuestionTypeID").ToString())
'suppose if QuestionTypeID="Radio" then the OptionList below should 'be listed wit RadioButton, else if QuestionTypeID="CheckBoxes"
'then the OptionList below should be listed with checkboxes...
Response.Write("<br>")
For Each cRow In pRow.GetChildRows(custAnswerListrel)
Dim li As ListItem = New ListItem(cRow("OptionList"), cRow("OptionID"))
Response.Write(vbTab & cRow("OptionID").ToString())
'Dim li As ListItem = New ListItem(cRow("OptionList"), cRow("OptionID"))
Response.Write(cRow("OptionList").ToString())
Response.Write("<br>")
Next
Next
InitializeComponent()
End Sub
can anyone help me? please...i really need your help..