December 2001
Intermediate to advanced
416 pages
8h 16m
English
The RadioButton of Web Forms is similar to that of Windows Forms, except that by default the event is cached rather than immediately handled. In the following example I've used a RadioButtonList control instead, binding to its DataSource property in a manner similar to that of DropDownList:
private void Page_Load( object sender, System.EventArgs e )
{
if ( ! IsPostBack )
{
string [] trainers = {
"Jennifer Juniper",
"Brian Bradley",
"Anita Anastasia"
};
RadioButtonList1.DataSource = trainers;
RadioButtonList1.DataBind();
}
}
SelectedIndexChanged() is also the event handler for this control. The SelectedIndex property identifies the selected radio button by its position within the item list. SelectedItem ...
Read now
Unlock full access