views:

243

answers:

2

ok this is my code in vb.net behind where i am creating the radiobutton -

 TD = New HtmlTableCell
                Dim rdb As New RadioButton()
                rdb.ID = "rdb_ads_" & DR("ID")
                TD.Controls.Add(rdb)
                TR.Cells.Add(TD)

It displays the radiobutton, but doesnt select single. i can select all at one time. how do i make it to select only 1 at a time. i know its basic for u guys, but will help me a lot

+1  A: 

You need to add the radiobutton to a radio button list control, otherwise you are telling your web form / client form that it doesn't belong to a control list and it is just a radio button sitting on a form.

  Dim rl As New RadioButtonList
        Dim r As New RadioButton
        r.ID = "111"
        rl.Controls.Add(r)
JonH
A: 

the comment section has been locked, so i cannot add comment. but this is for JonH's answer -

this is what i added - TD = New HtmlTableCell Dim rdb_list As New RadioButtonList() Dim rdb As New RadioButton() rdb.ID = "rdb_ads_" & DR("ID") rdb_list.Controls.Add(rdb) TD.Controls.Add(rdb_list) TR.Cells.Add(TD)

Doesnt WORK.

refer
You need to add all of the exclusive radiobuttons to the same RadioButtonList control for that to work.
Jacob G