RadioButton
From Section 6.4.7 of the book
This example allows you to select a certain method of payment using
RadioButtons. Every click on a RadioButton initiates
a round-trip, by which the selected payment method is displayed on the page.
RadioButton.aspx
<%@ Page Language="C#" %>
<html>
<head>
<script Language="C#" Runat="server">
void RadioChanged(object sender, EventArgs e) {
label.Text = "Method of payment: ";
if (cash.Checked) label.Text += cash.Text;
if (cheque.Checked) label.Text += cheque.Text;
if (card.Checked) label.Text += card.Text;
}
</script>
</head>
<body>
<form Runat="server">
<p>Select method of payment:</p>
<asp:RadioButton ID="cash" Text="cash" GroupName="payment"
OnCheckedChanged="RadioChanged" AutoPostBack="true"
Runat="server" /><br>
<asp:RadioButton ID="cheque" Text="cheque" GroupName="payment"
OnCheckedChanged="RadioChanged" AutoPostBack="true"
Runat="server" /><br>
<asp:RadioButton ID="card" Text="credit card" GroupName="payment"
OnCheckedChanged="RadioChanged" AutoPostBack="true"
Runat="server" /><br><br>
<asp:Label ID="label" Runat="server" />
</form>
</body>
</html>
|
Try it
http://dotnet.jku.at/book/samples/6/RadioButton.aspx
|