<script runat="server">
Sub submit(Sender As Object, e As EventArgs)
if red.Checked then
Label1.Text="您选择了 " & red.Text
elseIf green.Checked then
Label1.Text="您选择了 " & green.Text
elseIf blue.Checked then
Label1.Text="您选择了 " & blue.Text
end if
End Sub
</script>
<html>
<body>
<form runat="server">
请选择您喜欢的颜色:
<br />
<asp:RadioButton id="red" Text="Red" Checked="True"
GroupName="colors" runat="server"/>
<br />
<asp:RadioButton id="green" Text="Green"
GroupName="colors" runat="server"/>
<br />
<asp:RadioButton id="blue" Text="Blue"
GroupName="colors" runat="server"/>
<br />
<asp:Button text="提交" OnClick="submit" runat="server"/>
<p><asp:Label id="Label1" runat="server"/></p>
</form>
</body>
</html>