Use RadioButtonList.
"The RadioButtonList control provides page developers with a
single-selection radio button group that can be dynamically
generated
through data binding. It contains an Items collection with
members that
correspond to individual items on the list. To determine
which item is
selected, test the SelectedItem property of the list."
http://msdn2.microsoft.com/en-US/library/system.web.ui.webcontrols.radiobuttonlist.aspx
I haven't used it before but it sounds like to me the
following would be
possible:
' DataBind radiobuttonlist
Dim ds As New DataSet()
Dim da As New SqlDataAdapter(conn, "select DisplayText,
DataValue from tbl")
da.Fill(ds)
rdoList.DataSource = ds.Tables(0).DefaultView
rdoList.DataTextField = "DisplayText"
rdoList.DataValueField = "DataValue"
rdoList.DataBind()
' get the selected item
Sub submitBtn_Click()
Dim selectedItem As ListItem = rdoList.SelectedItem
Dim displayText As String = selectedItem.Text
Dim selectedValue As Int32 =
Convert.ToInt32(selectedItem.Value)
End Sub
Ron
"KrisAtWindward" <webforumsuser@macromedia.com> wrote
in message
news:e5j7j4$gb7$1@forums.macromedia.com...
> I'm using ASP.net w/ Access db. I created a form w/ a
group of radio
> buttons
> (used individual radio buttons instead of
RadioButtonList). I'm
> populating the
> radio button text and values from a database
(successfully). But, when I
> use
> the Insert Record Behavior to record the user's
selection in another
> table...I'm getting errors, or the value is just not
being passed to the
> db
> correctly.
>
> Should I be using a RadioButton List instead of
individual radio buttons
> in a
> group? Do I need to use an If/Then statement to isolate
the
> rdobutton.SelectedItem...or does the Insert Record
behavior identify the
> selected button in a group?
>
> Any help would be greatly appreciated. Or does anyone
know of a good
> tutorial
> online I could look at? I'm coding in VB. I'm trying to
teach this to a
> bunch
> of high school students and were all stumped.
>
> Thanks,
>
> Kris
>
>
>