C# Code
protected void RadioButtonList2_SelectedIndexChanged(object sender, EventArgs e)
{
SqlConnection sqlcon = new SqlConnection("Your Connection String Here");
for (int i = 0; i < Rad.Items.Count; i++)
{
if (Rad.Items[i] != null && Rad.Items[i].Selected)
{
sqlcon.Open();
SqlCommand sqlcom = new SqlCommand("insert into rd_table(radio) values('" + Rad.SelectedValue + "')", sqlcon);
sqlcom.ExecuteNonQuery();
sqlcon.Close();
break;
}
}
}
HTML Code
<asp:RadioButtonList ID="Rad" runat="server" OnSelectedIndexChanged="RadioButtonList2_SelectedIndexChanged"
RepeatDirection="Horizontal" AutoPostBack="true">
<asp:ListItem Value="0">c</asp:ListItem>
<asp:ListItem Value="1">a</asp:ListItem>
<asp:ListItem Value="0">c</asp:ListItem>
</asp:RadioButtonList>
Thanks,
Prashant
Mark Solution if this work for you!