I have three questions. I created javascript to hide an asp.net label. Please see below. I have an onClientClick event connected to an enter button and a radio button. The radio button did not work at all. Clicking the enter button worked but triggered a postback returning the value back to the default.
1) Is it possible to use an onClientClick event with a radio button?
2) How do I avoid a postback with the onClientClick event?
3) If I were to render the label not visible using server side script on page load:
asp:Label id="panel4lbl2" text="state:" style="display:block" visible="false" runat="server"/>
could I use javascript to make it visible triggered by an onClientClick event?
Thanks
Code:
--------------------------------------------------------
<script type="text/javascript">
<!--
function Hidecontrols()
{
document.getElementById('<%=panel4lbl2.ClientID%>').style.display='none';
}
//-->
</script>
</head>
<asp:RadioButton id=panel4radio1 runat="server" groupname="panel4radiogroup" text="Yes" OnClientClick="return Hidecontrols();" /><br>
<asp:RadioButton id=panel4radio2 runat="server" groupname="Panel4radiogroup" text="No" /><br>
<asp:Label id="panel4lbl2" text="state:" style="display:block" runat="server"/>
<asp:button id="checkjava" text="Next" OnClientClick="return Hidecontrols();" runat="server"/>