Click here to Skip to main content
15,886,664 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
gender values like male female and send it to data base in asp.net code behaind c#

XML
<td><asp:RadioButtonList ID="Radiobuttonlist1" runat="server">
    <asp:ListItem>male</asp:ListItem>
    <asp:ListItem>female</asp:ListItem>
    </asp:RadioButtonList></td>
  </tr>

.cs
cmd=new sqlcommand(insert into table_name values('"+radiobuttonlist1.selecteditem.text+"',con);
cmd.ExecuteNonQuery();
like this possible are not
Posted
Updated 3-May-11 2:37am
v2
Comments
Sunasara Imdadhusen 3-May-11 8:14am    
Not clear!!
evigneesh 3-May-11 8:18am    
I have an registration page that has radio button while clicking the radio button the data must send to data base coloum name gender

Dont send text values to database... u can send numeric to database like
For Male - 0
For Female - 1

Hope this helps
 
Share this answer
 
Comments
evigneesh 3-May-11 8:20am    
thanks can please provide code for that
try in the same way

<asp:RadioButtonList ID="rb_Isfresher" RepeatDirection="Horizontal"  runat="server"
OnSelectedIndexChanged="rb_Isfresher_SelectedIndexChanged" AutoPostBack="true">
<asp:ListItem Text="Yes" Value="0" Selected="True">
<asp:ListItem Text="No" Value="1">



//in the code behind

Boolean strIsFresher ;
 
 if (rb_Isfresher.SelectedValue == "1")
       {
           strIsFresher = true;
        }
   else
        {
          strIsFresher = false; 

}

// Send Boolean value to the Database
 
Share this answer
 
v2
Comments
evigneesh 3-May-11 8:33am    
thanks
Mahendra.p25 3-May-11 8:34am    
welcome

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