Introduction to RadioButton Control in Asp.net

Introduction to RadioButton Control in Asp.net

Controlling the led using pushbutton
Controlling the led using pushbutton

Below is the introduction to RadioButton Control in asp.net :

  • RadioButton control is the option button that can be checked on/off.
  • Use a radio button when you want the user to choose only one option.When you want the user to choose all appropriate options, use a check box.
  • When a user clicks on a radio button, it becomes checked, and all other radio buttons with same group become unchecked.
  • All RadioButtons in the same group must have the same GroupName property.

Properties Of RadioButton Control

Below is the description of the properties of RadioButton control :-

Introduction to RadioButton Control in Asp.net

Adding RadioButton Control to WebForm

  • Drag & Drop the RadioButton control from the Toolbox task pane to your Web Page.
  • Set properties for the control in the Properties task pane.

Introduction to RadioButton Control in Asp.net

Use RadioButton Control in Asp.net

  • You can use the GroupName property when only one selection is possible from a list of available options.When this property is set, only one RadioButton in the specified group can be selected at a time.
  • If you want to perform operation on selection of RadioButton then you will set the AutoPostBack to true.

Example:-

When user wants to select his/her favorite color.

  • Design Web Form (WebForm1.aspx page).

Introduction to RadioButton Control in Asp.net

  • Generate Code in Code-Behind File (WebForm1.aspx.cs page).

Introduction to RadioButton Control in Asp.net

  • Output: Press “F5” or “Ctrl + F5”. Select Your Favorite Color.

Introduction to RadioButton Control in Asp.net

Leave a Comment