Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

working with radiobutton groups

Status
Not open for further replies.

fergmj

Programmer
Feb 21, 2001
276
US
I have 40 radiobutton groups. This is an online test and the user chooses one radio button from each group to answer a question.

I am looking for a way to loop thru each of the radio button groups and populate my database with the value of the radiobutton that was chosen.
 
If the questions are populated dynamically , store max question in a variable and name radio button group in such a way that rgQ1,rgQ2 etc., then after submiting
for loop substitue radiobutton rgQi with index, collect values and store it db.

Let me know wheather others got better logic than this.

 
What I am struggling with is the actual for loop to go thru each of the radiobutton groups. They are named rdoQuestion1, Question2 etc.

Thanks
 
You are probably best of putting all of the controls in a Panel/PlaceHolder and then looping through it's controls collection. Something like this should get you started:
Code:
        For Each ctl As Control In Panel1.Controls
            If TypeOf ctl Is RadioButtonList Then
                ...
            End If
        Next


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top