<html>
<head>
<title>HtmlInputCheckBox Control Example</title>
<link rel="stylesheet" href="/shared/netdemos.css">
<script language="C#" runat="server">
void getChecked ( object src, EventArgs e ) {
if ( Check1.Checked || Check2.Checked || Check3.Checked ||
Check4.Checked || Check5.Checked || Check6.Checked ) {
msg.InnerHtml = "Looks like you prefer: ";
if ( Check1.Checked ) msg.InnerHtml += " " + Check1.Value;
if ( Check2.Checked ) msg.InnerHtml += " " + Check2.Value;
if ( Check3.Checked ) msg.InnerHtml += " " + Check3.Value;
if ( Check4.Checked ) msg.InnerHtml += " " + Check4.Value;
if ( Check5.Checked ) msg.InnerHtml += " " + Check5.Value;
if ( Check6.Checked ) msg.InnerHtml += " " + Check6.Value;
}
else msg.InnerText = "Looks like you're not a yogurt fan.";
}
</script>
</head>
<body>
<!-- #include virtual="~/shared/top.inc -->
<div class="header"><h2><span class="hilite">HtmlInputCheckBox Control</span> Example</h2></div>
<hr size=1 width=92%>
<center>
<form runat="server">
<p><b>Yogurt flavors I like:</b></p>
<table cellpadding=20 style="background-color: beige; border: 2px inset">
<tr>
<td><label><input type=checkbox id="Check1"
value="Strawberry" runat="server" />Strawberry</label><br>
<label><input type=checkbox id="Check2"
value="Vanilla" runat="server" />Vanilla</label><br>
<label><input type=checkbox id="Check3"
value="Campina " runat="server" />Campina</label></td>
<td><label><input type=checkbox id="Check4"
value="Custard" runat="server" />Custard</label><br>
<label><input type=checkbox id="Check5"
value="Pavlova" runat="server" />Pavlova</label><br>
<label><input type=checkbox id="Check6"
value="Raspberry" runat="server" />Raspberry</label></td>
</tr>
</table>
<p><input type=button value="Show me"
onServerClick="getChecked" runat="server"></p>
<p id="msg" runat="server" /></p>
</form>
</center>
<hr size=1 width=92%>
<!-- #include virtual="~/shared/viewsrc.inc" -->
</body>
</html>