i used in this below code in usercontrol

but error happen

because the checkbox value didn't pass

please help how to pass the checkbox value

i try <!--onclick="checkedChanged(this,'checkbox')--> this line

but the checkbox is runat=server

so different value is generated in html view source code...

so doesn't work this code...........


function checkedChanged(PanelId,ChkID)
{
if(ChkID.checked == true)
{
PanelId.style.backgroundColor="Yellow";

return true;

}
if(ChkID.checked == false)
{
PanelId.style.backgroundColor="YellowGreen";
}
return false;

}


<div id="Panel1" style="WIDTH: 64px; HEIGHT: 48px; BACKGROUND-COLOR: yellowgreen" onclick="checkedChanged(this,checkbox) runat="server">
<img id="imgcolor" style="WIDTH: 32px; HEIGHT: 31px" height="31" src="file:///\\system107\HIS\Images\seat2.jpg"
width="32" align="middle" runat="server">
<input type="checkbox" id="Checkbox1" name="Checkbox1" runat="server">
<label id="Label1" runat="server"></label>
</div>

Try this :

onclick="checkedChanged(this, document.YourFormName.Checkbox1)

You need to define passed object not by type, but by name.

Hai thanks for your reply...........

i already try this code...

dcument.myform.checkbox1 is not a null object error display..

because i am not used form tag with " runat=server"

because i am used this code in one usercontrol page in asp.net..

i call this user controls page another aspx page..

so the form tag runat=server should only one form...

please help how to pass checkbox(this) value..

reply please.........

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.