hi..
i wanna ask...how can i add controls such as RadioButton @ CheckBoxes @ TextBox into panel?

i need to view my OptionList based on my QuestionType

Dim sql As SqlCommand=("SELECT Question.QuestionTypeID,AnswerList.OptionID,AnswerList.OptionList FROM QUESTION, AnswerList WHERE AnswerList.SurveyID = 83 AND AnswerList.QuestionNum=1",MyConn)
Dim readQ As SqlDataReader = sql.ExecuteReader()

 While readQ.Read
            Dim qtype As String = readQ("QuestionTypeID").ToString
            If qtype = 1 Then
                Dim rad As New RadioButtonList
                With rad
                    .DataSource = readQ
                    .DataValueField = "OptionID"
                    .DataTextField = "OptionList"
                    putOption.Controls.Add(rad)
            
                End With
            ElseIf qtype = 2 Then
                Dim chk As New CheckBoxList
                With chk
                    .DataSource = readQ
                    .DataValueField = "OptionID"
                    .DataTextField = "OptionList"
                    putOption.Controls.Add(chk)
                End With
            Else
                Dim txtbox As New TextBox
                putOption.Controls.Add(txtbox)
            End If
        End While

fyi, putOption is the panel which i want to insert my controls...

please guide me..help is very much appreciated..

In addition...Right now, all the controls didn't show up in page_load\

where did i do wrong?


~i want to learn~

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.