Author: brian.f.hayes | Posted on: 7/16/2009 8:18:21 AM | Views : 370

Hi there,
I have written the following piece of code which will create a radiobutton list for each entry retrieved from the database:
For i = 0 to dsQuestions.tables(0).rows.count - 1

        Dim RadioButtonAnswers As New RadioButtonList


        RadioButtonAnswers.DataTextField = "text" 'dsAnswers.Tables(0).Columns("text").ToString
        RadioButtonAnswers.DataValueField = "_id"
        RadioButtonAnswers.DataSource = dsAnswers.Tables(0).DefaultView
        RadioButtonAnswers.DataBind()


        RadioButtonAnswers.RepeatDirection = RepeatDirection.Horizontal
        phQuestions.Controls.Add(RadioButtonAnswers)
Next

< ...

Go to the complete details ...