Click here to Skip to main content
15,894,017 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am very new in asp.net.My sir give to make one registration form.

I am handling Visual Studio 2008 for the very first time.I have problem when it comes to gender Men and Female where i used radio buttons.

But when i debug my whole program at the local host,when i click to Men then its ok.But again i change my selection with Female its not going on.Both gender are showing clicked.
Please help me out.What changes should i make in my source code?

Sonali
Posted
Updated 27-Nov-13 23:12pm
v2

You were supposed to use this:
C#
<asp:RadioButtonList ID="RadioButtonList1" runat="server">
    <asp:ListItem Text="Male" Value="M"></asp:ListItem>
    <asp:ListItem Text="Female" Value="F"></asp:ListItem>
</asp:RadioButtonList>

Note: Don't use all capital letters on internet. Its called shouting and considered rude.
 
Share this answer
 
v2
please ensure that both the radiobuttons are in the same Group.
I think it is the reason..
 
Share this answer
 
Hi..

Specify group name for radio buttons like
C#
<asp:radiobutton id="rdoButton1" groupname="Group1" text="Male" value="Male" runat="server" />
  <asp:radiobutton id="rdoButton2" groupname="Group1" text="Female" value="Female" runat="server"/>
 
Share this answer
 
v2
Comments
Member 10431704 28-Nov-13 6:16am    
thank you so much...it works....
hello ,
try this code
C#
protected void RadioButton_CheckedChanged(object sender, System.EventArgs e)
{
    if (RadioButton1.Checked == true)
    {
        Label1.Text = "You choose: " + RadioButton1.Text;
    }
    else
    {
        Label1.Text = "You choose: " + RadioButton2.Text;
    }
}
 
Share this answer
 
v3
please give the group name same to both radio button control.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900