Click here to Skip to main content
16,016,477 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have a a dropdown list with 2 options. Selecting first option from dropdown I display a DIV which has two categories for user to answer.These are radio buttons to be selected.
However after selecting second option from the drop down list,the DIV area is hidden.
Again I select the first option from the drop down list.
Doing this I am losing the user selected values from radio buttons as they get selected to default. How can I retain them to user selected? I am using the "checked" attribute.
Still doesn't work.
Following is the code snippet.


HTML
<TABLE id="Mytable"><TBODY>
<TR>
<TD>
<INPUT type=radio id="firstone" name="first" onclick="" VALUE="1" <%=("1".equals(Mytable)?"CHECKED":"")%>></TD>
<INPUT type=radio id="secondone" name="second" onclick="" VALUE="2" <%=("2".equals(Mytable)?"CHECKED":"")%>></TD>
</TR>
</TBODY>
</TABLE>
Posted
Comments
jacobjohn196 7-Apr-14 4:38am    
Hi,
If you have any code in pageload, put it inside if(!IsPostBack).
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//Your code
}
}
sudeepvajrala4114 11-Apr-14 5:17am    
Please post your code to toggle the HTMl when you have selected options in the dropdown.

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