HTML check box stays checked once come back from server....

  • Thread starter Thread starter RSB
  • Start date Start date
R

RSB

Hi,
i have the code attached down. i am using this HTML Check box and have it
set up runat server. Now if once we select this checkbox and subit the page
after that if keeps the Checkbox checked all the time. For somereason the
next change is the State is not getting reflected or handled properly.
How to make is work properly.
Tried using ASP:checkbox but having some client side issues with that also
...(i have an another post with that issue... :o(( )

Please help.
Thanks
RSB


<%@ Page Language="vb" AutoEventWireup="false" src="mypage.aspx.vb"
Inherits="mypage"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>testpage</title>
<script language="javascript">
<!--
function checkthis()
{
window.document.Form1.checkbox1.disabled=false;
window.document.Form1.Button1.disabled = false;
}

-->

</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:Button id="Button1" Enabled="False" runat="server"
Text="Button"></asp:Button>
<INPUT type="button" value="Button" onclick="javascript:checkthis()">
<INPUT runat="server" id="checkbox1" disabled type="checkbox" >
<INPUT type="text">
</form>
</body>
</HTML>
 
browsers will not postback a disabled field. in the case of a checkbox, this
is indistinguishable from being unchecked (which also means don't post
back). you should use a hidden field to mirror the values of a disabled
fields that are not blank.

-- bruce (sqlwork.com)
 
Hi Bruce,
But i am enabling the Checkbox on the client end and then change it.(Check
or uncheck it) and then Submit the Page back to the Server...

RSB

browsers will not postback a disabled field. in the case of a checkbox, this
is indistinguishable from being unchecked (which also means don't post
back). you should use a hidden field to mirror the values of a disabled
fields that are not blank.

-- bruce (sqlwork.com)
 
Back
Top