Asp net radiobuttonlist


ASP.NET is a popular programming language used for developing web applications. One of the requirements in web development is to create a group of radio buttons where the user can select only one option. In ASP.NET, we can achieve this using the RadioButtonList control.

Creating a RadioButtonList

To create a RadioButtonList in ASP.NET, we need to add the RadioButtonList control to our web form. We can do this by dragging and dropping the control from the toolbox onto the design view of our web form.


In the above code, we have created a RadioButtonList control with three options: Option 1, Option 2, and Option 3. Each option is represented by an tag. The Text specifies the display text for the option, and the Value attribute specifies the value associated with the option.

Accessing the Value

To the selected value of the RadioButtonList control in ASP.NET, we can use the SelectedValue property. This property returns the value of the selected option.

string selectedValue = rbList.SelectedValue;

In the above code, we are assigning the selected value of the RadioButtonList control to a variable named selectedValue.

SelectedIndexChanged Event

If we want to some action when the user selects a different option in the RadioButtonList, we can the SelectedIndexChanged event. This event is triggered when the selected option changes.

protected void rbList_SelectedIndexChanged(object sender, EventArgs e)
    // Perform action based on the selected option

In the above code, we have defined a named rbList_SelectedIndexChanged which will be called when the selected option changes. We can write our this method to perform the desired action.


In this article, we have explored how to create a RadioButtonList control in ASP.NET and how to access the selected value. We have also seen how to handle the SelectedIndexChanged event to perform actions based on the selected option. The RadioButtonList control is a useful tool for creating groups of radio buttons in web applications.

Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents