<head>
<title>RadioButton Example</title>
<link rel="stylesheet" href="/shared/netdemos.css">
<script language="C#" runat="server">
string [ ] answers = {
"Abraham Lincoln came a tad bit later.",
"Christopher Columbus was an explorer, <br>not a United States President.",
"Correct. George Washington was the first President <br>of the United States of America.",
"Robert Plant was the lead vocalist of Led Zeppelin, <br>not a United States President."};
void chkAnswer ( object src, EventArgs e ) {
string txt = "";
if ( Radio1.Checked )
txt += answers [ 0 ];
else if ( Radio2.Checked )
txt += answers [ 1 ];
else if ( Radio3.Checked )
txt += answers [ 2 ];
else if ( Radio4.Checked )
txt += answers [ 3 ];
msg.InnerHtml = txt;
}
</script>
</head>
<body>
<!-- #include virtual="~/shared/top.inc -->
<div class="header"><h2>RadioButton Example</h2></div>
<!-- #include virtual="~/shared/viewsrc_top.inc" -->
<hr size=1 width=92%>
<div align="center">
<form runat="server">
<h5>The first president of the United States was:</h5>
<table>
<tr><td>
<asp:RadioButton id="Radio1" Text="Abraham Lincoln"
GroupName="choices" runat="server" /><br>
<asp:RadioButton id="Radio2" Text="Christopher Columbus"
GroupName="choices" runat="server" /><br>
<asp:RadioButton id="Radio3" Text="George Washington"
GroupName="choices" runat="server" /><br>
<asp:RadioButton id="Radio4" Text="Robert Plant"
GroupName="choices" runat="server" /><br>
</td></tr>
</table>
<p><asp:button text="Submit" onClick="chkAnswer" runat="server" />
<p id="msg" runat="server" />
</form>
</div>
<hr size=1 width=92%>
<!-- #include virtual="~/shared/viewsrc.inc" -->
</body>
</html>