I have 4 check boxes if i select only one check box then that Label and another check box shoould visible, If i select any other 3 check boxes that label and another check box should hide? Can some one help? With Javascript
Error 9 'ASP.modifyuser_aspx' does not contain a definition for 'forRentClicked' and no extension method 'forRentClicked' accepting a first argument of type 'ASP.modifyuser_aspx' could be found (are you missing a using directive or an assembly reference?) C:\aparitala\PAP_DEV\ModifyUser.aspx 276
aparitala
Member
13 Points
83 Posts
How to show/hide a Label on selecting Check Boxes With Javascript
Dec 12, 2012 04:11 PM|LINK
Hi,
I have 4 check boxes if i select only one check box then that Label and another check box shoould visible, If i select any other 3 check boxes that label and another check box should hide? Can some one help? With Javascript
march11
Contributor
3015 Points
1364 Posts
Re: How to show/hide a Label on selecting Check Boxes With Javascript
Dec 12, 2012 04:28 PM|LINK
Please post your question in a forum for javascript!!!
pratikkapadi...
Member
172 Points
32 Posts
Re: How to show/hide a Label on selecting Check Boxes With Javascript
Dec 12, 2012 04:38 PM|LINK
Put your controls inside one div
<div id="div1">
<asp:Label ID="Label1" runat="server" Text="Rental rate per week:"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>
And modify your javascript funtion
function forRentClicked() {
</div> </div>if (document.getElementById('<%= CheckBox1.ClientID %>').checked == true) {
document.getElementById('div1').style.display = 'none';
}
else {
document.getElementById('div1').style.display = '';
}
}
aparitala
Member
13 Points
83 Posts
Re: How to show/hide a Label on selecting Check Boxes With Javascript
Dec 12, 2012 04:55 PM|LINK
Hi Thank You!
It showing this error message ?
Error 9 'ASP.modifyuser_aspx' does not contain a definition for 'forRentClicked' and no extension method 'forRentClicked' accepting a first argument of type 'ASP.modifyuser_aspx' could be found (are you missing a using directive or an assembly reference?) C:\aparitala\PAP_DEV\ModifyUser.aspx 276
pratikkapadi...
Member
172 Points
32 Posts
Re: How to show/hide a Label on selecting Check Boxes With Javascript
Dec 12, 2012 04:59 PM|LINK
hey put your code here....full html...
aparitala
Member
13 Points
83 Posts
Re: How to show/hide a Label on selecting Check Boxes With Javascript
Dec 12, 2012 06:17 PM|LINK
<script language="javascript" type="text/javascript"> function hidethis(rdl) { if (document.getElementById('<%=rdLevel2.ClientID%>').checked = true) { document.getElementById('<%=div.ClientID%>').style.display = ' '; document.getElementById('<%=this.rdl.ClientID%>').checked = true; } else { document.getElementById('<%=lblMaster.ClientID%>').visible = false; document.getElementById('<%=chkIsMaster.ClientID%>').checked = false; document.getElementById('<%=chkIsMaster.ClientID%>').visible = false; document.getElementById('<%=div.ClientID%>').style.display = 'none'; alert("None"); } } </script> Code: <asp:RadioButton ID="rdLevel1" runat="server" GroupName="PrivilegeLevel" Text="Agent" Width="80px" Font-Bold="True" Font-Names="Verdana" Font-Size="X-Small" onclick="hidethis(this);" /> <asp:RadioButton ID="rdLevel2" runat="server" GroupName="PrivilegeLevel" Text="Supervisor" Width="100px" Font-Bold="True" Font-Names="Verdana" Font-Size="X-Small" onclick="hidethis(this);" /> Portion to hide on pressing : <div id="div" runat="server"> <asp:Label Text="Do you want to give access full access to this user? :" runat="server" ID = "lblMaster" Visible="false" ></asp:Label> <asp:CheckBox ID="chkIsMaster" runat="server" Visible="false" /> </div>