You have to make a radiobuttonlist as follows
Formatted for
HTML with the GeSHI Syntax Highlighter [
copy or print]
<asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="True"
RepeatColumns="3" TextAlign="Left">
<asp:ListItem Value="1">07:00AM-07:15AM</asp:ListItem>
<asp:ListItem Value="2">07:15AM-07:30AM</asp:ListItem>
<asp:ListItem Value="3">07:30AM-07:45AM</asp:ListItem>
<asp:ListItem Value="4">07:45AM-08:00AM</asp:ListItem>
</asp:RadioButtonList>
Then add some statements to make sure its working (inside submitButton_Click). radioButton is my label
Formatted for
C# with the GeSHI Syntax Highlighter [
copy or print]
if (RadioButtonList1.SelectedIndex > -1)
{
radioButton.Text = "<br />you selected: " + RadioButtonList1.SelectedIndex.ToString();
}
else
{
radioButton.Text = "Select a radio button";
}
Then attache it to the database like so:
Formatted for
C# with the GeSHI Syntax Highlighter [
copy or print]
appNameComm
= new SqlCommand
("INSERT INTO AppointmentName (LastName, FirstName, Email, BirthDate, Slot) " + "VALUES (@LastName, @FirstName, @Email, @BirthDate, @Slot)", conn);
.
.
.
appNameComm.Parameters.Add("@Slot", System.Data.SqlDbType.Int, 2);
appNameComm.Parameters["@Slot"].Value = RadioButtonList1.SelectedIndex.ToString();