ASP 101 - Active Server Pages 101 radiobutton.aspx
<%@ Page Language="VB" %>
<script language="VB" runat="server">
	Sub Page_Load(sender As Object, e As EventArgs)
		' Retrieve and display the values for each radio button/group
		' Default No-Frills HTML Radio Button:
		' Note that "on" is in lower case.  Since writing "on"
		' doesn't do much good, I simply check for it to determine
		' which branch of the conditional to execute.  I could
		' place whatever code I wanted inside either condition.
		' In this case I simply print out a "user-friendly" message.
		If Request.Form("default") = "on" Then
			lblHtmlNoFrills.Text = "Enabled"
			lblHtmlNoFrills.Text = "Disabled"
		End If
		' HTML Radio Button With An Associated Value:
		lblHtmlValue.Text = Request.Form("value_specified")
		' Multiple HTML Radio Buttons With the Same Name:
		lblHtmlMulti.Text = Request.Form("multiple")
		' ASP.NET RadioButton Control:
		radAspNetRadioButton.Text = " ASP.NET RadioButton Control Text Label"
		If radAspNetRadioButton.Checked Then
			lblAspNetRadioButton.Text = "Enabled"
			lblAspNetRadioButton.Text = "Disabled"
		End If
		' ASP.NET RadioButtonList Control:
		' On the first run we fill our RadioButtonList with something.
		' You can also fill it manually, but that's no fun!  ;)
		If Not Page.IsPostBack Then
			Dim arrRBLItems(2) As String
			arrRBLItems(0) = "Item 1"
			arrRBLItems(1) = "Item 2"
			arrRBLItems(2) = "Item 3"
			rblAspNetRadioButtonList.DataSource = arrRBLItems
		End If
		' Since we know that only one radio button can be selected
		' we don't have to check them all like we did in the checkbox
		' sample.  This time we just get the selected one.
		If Not(rblAspNetRadioButtonList.SelectedItem Is Nothing) Then
			lblAspNetRadioButtonList.Text = rblAspNetRadioButtonList.SelectedItem.Text
		End If
	End Sub
<title>ASP.NET Radio Button Sample</title>
<form runat="server">
  <h2>Some sample radio button form elements:</h2>
  Default No-Frills HTML Radio Button:
  <input type="radio" name="default" />
  <br />
  HTML Radio Button With An Associated Value:
  <input type="radio" name="value_specified" value="Some Value" />
  <br />
  Multiple HTML Radio Buttons With the Same Name:
  <input type="radio" name="multiple" value="1" />
  <input type="radio" name="multiple" value="2" />
  <input type="radio" name="multiple" value="3" />
  <br />
  <br />
  ASP.NET RadioButton Control:
  <asp:RadioButton id="radAspNetRadioButton" runat="server" />
  <br />
  ASP.NET RadioButtonList Control:
  <asp:RadioButtonList id="rblAspNetRadioButtonList" runat="server"
    RepeatLayout    = "Flow"
    RepeatDirection = "Horizontal"
  <br />
  <br />
  <input type="submit" />
<br />
<br />
<br />
<h2>Let's check out our values just submitted:</h2>
FYI: Note that the above form submits back to this same page.
If you haven't yet submit the form then there won't be
any values in the text below since they are retrieved
from the form.  In this case, the values reflected are
simply the defaults and are the same results you would
get if you submitted the form without selecting anything.
Just because we're using ASP.NET doesn't mean we have to use
ASP.NET server controls.  The first couple samples use plain
old HTML and work just fine.  In fact, unless you need the
functionality offered by the RadioButton or RadioButtonList
controls using plain old HTML actually uses fewer server
<p><strong>Default No-Frills HTML Radio Button</strong></p>
By default, an HTML radio button element returns nothing
if it wasn't enabled and a value of "on" if it was.
So by checking it's value we can determine if it was
enabled or not when the form was submitted.
The Default No-Frills HTML Radio Button was:
<strong><asp:Label id="lblHtmlNoFrills" runat="server" /></strong>.
<p><strong>HTML Radio Button With An Associated Value</strong></p>
If you don't like the fact that the radio button returns the
value of "on" it's really easy to change.  Simply
add a value parameter and assign to it what you'd like the
value returned by the radio button to be.
The HTML Radio Button With An Associated Value returned:
<strong><asp:Label id="lblHtmlValue" runat="server" /></strong>.
<p><strong>Multiple HTML Radio Buttons With The Same Name</strong></p>
Similarly to the checkbox, the scenario where you have a set
of radio buttons all with the same name is probably one of the
most useful ways to use this type of input tag.  The main
difference is that instead of allowing a user to specify
multiple answers to one question, the radio button element
ensures that one and only one selection is choosen from among
the group of buttons that share a common name.
The Multiple Radio Buttons With The Same Name
(which ensures that only one choice is selected) returned:
<strong><asp:Label id="lblHtmlMulti" runat="server" /></strong>.
<p><strong>ASP.NET RadioButton Control</strong></p>
This is just a plain old ASP.NET RadioButton control, but just by
it being an ASP.NET control we get all the associated benefits.
For example, we can programmatically manipulate it (like I do
by adding the label to it) and it keeps its state across page
ASP.NET RadioButton Control was:
<strong><asp:Label id="lblAspNetRadioButton" runat="server" /></strong>.
<p><strong>ASP.NET RadioButtonList Control</strong></p>
This is the ASP.NET control for dealing with a group of radio 
buttons.  You can do all sorts of cool stuff with it.  I'm going
to keep things pretty simple, but I do play with the RepeatLayout
and RepeatDirection and use databinding to fill the list with the
individual radio buttons.
ASP.NET RadioButtonList Control contained the following selected items:
<strong><asp:Label id="lblAspNetRadioButtonList" runat="server" /></strong>.
<hr />
Click <a href="">here</a>
to read about and download the source code.