<html>
<head>
<title>Getting and Setting a CheckBox Web Control Value Programmatically</title>
<link rel="stylesheet" href="/shared/netdemos.css">
<script language="C#" runat="server">
void Page_Load ( object src, EventArgs e ) {
msg.Text = "";
}
void myClickHandler ( object src, EventArgs e ) {
if ( chkSavePass.Checked )
msg.Text = "Save Password checked poperty has been set to " + chkSavePass.Checked;
else
msg.Text = "Save Password checked poperty has been set to " + chkSavePass.Checked;
}
</script>
</head>
<body>
<!-- #include virtual="~/shared/top.inc -->
<div class="header"><h2>Getting and Setting a CheckBox Web Control Value Programmatically</h2></div>
<!-- #include virtual="~/shared/viewsrc_top.inc" -->
<hr size=1 width=92%>
<br>
<form runat="server">
<div align="center">
<asp:CheckBox id="chkSavePass" Text="Save Password" runat="server"
onCheckedChanged="myClickHandler" autopostback />
<p><!-- spacer --></p>
<asp:Label id="msg" runat="server" />
</div>
</form>
<hr size=1 width=92%>
<!-- #include virtual="~/shared/viewsrc.inc" -->
</body>
</html>