ASP.NET Tutoria...login
ASP.NET Tutorial
author:php.cn  update time:2022-04-11 14:18:18

RadioButton control


ASP.NET RadioButton Control


up.gif Web server control

Definition and usage

RadioButton control to display radio buttons.

Tip: To create a series of radio buttons using data binding, please use the RadioButtonList control!


Properties

PropertiesDescription
AutoPostBackBoolean value, specifies whether to return the form immediately after the Checked attribute is changed. The default is false.
CheckedBoolean value, specifies whether the radio button is selected.
idThe unique id of the control.
GroupNameThe name of the control group to which this radio button belongs.
OnCheckedChangedThe name of the function that is executed when the Checked property is changed.
runat Specifies that the control is a server control. Must be set to "server".
TextThe text next to the radio button.
TextAlignOn which side of the radio button should the text appear (left or right).


Example

Radiobutton
In this example, we declared three RadioButton controls in the .aspx file, A Button control, and a Label control. When the submit button is triggered, the submit subroutine is executed. The submit subroutine will respond in three ways: if the radiobutton with the id="red" attribute is selected, the server sends the message "You selected Red" to the Label control; if the radiobutton with the id="green" attribute is selected If selected, the server sends the message "You selected Green" to the Label control; if the radiobutton with the id="blue" attribute is selected, the server sends the message "You selected Blue" to the Label control.


up.gif Web Server Control

php.cn