Please visit our sponsors !
HtmlInputCheckBox Control
Definition and Usage
The HtmlInputCheckBox control is used to control an <input
type="checkbox"> element. In HTML, this element is used to create a checkbox.
Properties and Events
Property |
Description |
Checked |
A Boolean value that indicates whether the control is checked
or not |
id |
A unique id for the control |
runat |
Specifies that the control is a server control. Must
be set to "server" |
Event |
Description |
ServerChange |
Occurs when the state of the control has changed |
Example 1
In the following example we declare one HtmlInputCheckBox
control, one HtmlGeneric control, and one HtmlInputButton
control in an .aspx file (remember to embed the controls
inside an HtmlForm control). When the submit button is triggered, the submit subroutine is executed. The
submit subroutine may respond in two ways: if the checkbox is checked, the
server sends the message "The checkbox is checked!" to the span control. If the
checkbox is not checked, the server sends the message "The checkbox is not
checked!" to the span control:
<script runat="server">
Sub submit(Source As Object, e As EventArgs)
if c1.Checked=True then
s1.InnerHtml="The checkbox is checked!"
else
s1.InnerHtml="The checkbox is not checked!"
end If
End Sub
</script>
<html>
<body>
<form runat="server">
<input id="c1" type="checkbox" runat="server" />
<span id="s1" runat="server" />
<br /><br />
<input type="button" id="b1" value="Enter"
OnServerClick="submit" runat="server"/>
</form>
</body>
</html>
|
Jump to: Top of Page
or HOME or
Printer friendly page
Search W3Schools:
What Others Say About Us
Does the world know about us? Check out these places:
Dogpile
Alta Vista
MSN
Google
Excite
Lycos
Yahoo
Ask Jeeves
We Help You For Free. You Can Help Us!
W3Schools is for training only. We do not warrant its correctness or its fitness for use.
The risk of using it remains entirely with the user. While using this site, you agree to have read and accepted our
terms of use and
privacy policy.
Copyright 1999-2002 by Refsnes Data. All Rights Reserved
|