What is RadioButton Control and how to use RadioButton Control in ASP.NET

What is RadioButton Control and how to use RadioButton Control in ASP.NET

0 350
how to use radiobutton control in asp.net

What is RadioButton Control and how to use RadioButton Control in ASP.NET

RadioButton is a Standard Control which found in Toolbox in Visual Studio (VS) Framework. In this article I will describe that What is RadioButton Control and how to use RadioButton Control in ASP.NET. RadioButton control is  used to select a single value out of many. User can not select more than one value at a time. RadioButton control is always used in group. We will discuss all the details step by step.

How to insert RadioButton Control

To insert RadioButton control first click on toolbox and then either double click on RadioButton control or you may drag it to your web form. When you insert this control in your web form then following coding automatically appears:

 

 

In above coding Default ID automatically generates which you may change as per your desire. Now our next step is to insert items. Consider the following coding and also watch the video for more details:

 

 

Remember that the value of GroupName Property for each control will be same. If this value differs than the RadioButton Controls will be treated separated.

 

 

Property of RadioButton Control

 

  1. AutoPostBack

When this property is set to true then on clicking (check or uncheck) the RadioButton control, page postback to server. Postback to server means that the request goes to server to reload the page. This property is set to true when we require to perform any task on clicking the checkbox control and for this we can use CheckedChanged Event to handle this task.

  1. CheckedChanged Event

CheckedChanged event is used to handle any task when someone clicks on the RadioButton item. To create CheckedChanged event just go to the property of the RadioButton and click in the CheckedChanged textbox and press enter. On pressing enter an event with the default name will be generated. If you want to give any name to this event then type the name of the event and then press enter. Just watch the following video to understand this….

 

 

  1. Checked

This property has 2 values namely true and false. When this property set to true then the control remains checked and when this is set to false then the control remains unchecked.

 

  1. OnCheckedChanged

In RadioButton property you may see CheckedChanged event. But when you create this event then in source page the event create with the name OnCheckedChanged while in aspx.cs page the event creates with the name CheckedChanged. Watch above video carefully. You may handle CheckedChanged event in this segment

RadioButton is not very typical control. I have discussed all main features of this control in this article. In my next article I will describe that how  we can use RadioButton Control in programming. Till then happy coding…

 

 

 

 

 

NO COMMENTS

Leave a Reply