System.Web.UI.HtmlControls Namespace HtmlInputRadioButton Class
Sets or retrieves a value indicating whether the HtmlInputRadioButton is checked.
Inline |
<input type=radio checked ... > |
Script |
HtmlInputRadioButton.Checked [ = true | false ] |
This property accepts or returns only a boolean value: true if the HtmlInputRadioButton is currently selected; otherwise, false. Default value is false.
Use this property to specify or determine whether the HtmlInputRadioButton control is selected, or checked. This property can also be used to programmatically set the state of the radio button control.
Radio buttons that are not selected do not send their values when the form is submitted.
The following illustrates how the Checked property of an HtmlInputRadioButton control can be used to determine user input.
void chkAnswer ( Object Sender, EventArgs e ) {
string msg = "";
if ( Radio1.Checked ) msg += answers [ 0 ];
else if ( Radio2.Checked ) msg += answers [ 1 ];
else if ( Radio3.Checked ) msg += answers [ 2 ];
else if ( Radio4.Checked ) msg += answers [ 3 ];
Message.InnerHtml = msg;
}
Show me
HtmlInputRadioButton Members