Click here to Skip to main content
15,917,795 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
HTML
<input type="radio" name="GenderSelect" value=1 />Male<br/>
<input type="radio" name="GenderSelect" value=0 />Female


I have got a var called Gender. I wana check one of these 2 buttons based on Gender's value. if(gender==1) male is checked otherwise female. I need server-side (asp.net) code snippet not js.
Posted
Updated 14-Dec-12 21:33pm
v3
Comments
[no name] 15-Dec-12 3:15am    
Your question is uncertain, Place your JS/C# code here..
Do you want to do it in JavaScript or Server Side?
cs101000 15-Dec-12 3:29am    
Server Side
rahkan 15-Dec-12 9:05am    
Where's your server-side code that you're using?

XML
<input type="radio" name="GenderSelect" value=1 runat="server"/>Male<br/>
<input type="radio" name="GenderSelect" value=0 runat="server"/>Female
 
Share this answer
 
Comments
cs101000 21-Dec-12 8:32am    
What does that 'runat' attribute do? And how can I specify my condition then?
Use <asp:RadioButton ID="RadioButton1" runat="server"/> tag instead of input type. You can easily check that which value got selected.
 
Share this answer
 
v2
Comments
cs101000 21-Dec-12 4:08am    
You mean like this:

<asp:radiobutton xmlns:asp="#unknown" name="GenderSelect" value="1" style="padding: 0px">male

<asp:radiobutton xmlns:asp="#unknown" name="GenderSelect" value="0" style="padding: 0px">female

When I use this the texts 'male' and 'female' are displayed but the buttons are not displayed at all.
VishwaKL 21-Dec-12 4:25am    
drag and drop radio button from the tool box, no need to write it down buddy,
cs101000 21-Dec-12 8:29am    
Im afraid webmatrix doesnt have a toolbox!

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