reffer
reffer

Reputation: 1

creating a radiobutton control in vb.net

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

Upvotes: 0

Views: 1747

Answers (1)

JonH
JonH

Reputation: 33173

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)

Upvotes: 1

Related Questions