C# .NET - how to use radiobutton list code in c#.net?

Asked By deepi singh on 16-Dec-11 04:29 AM
i have to keep 3 radio buttons in asp.net and also i have to write code in selected index changed event?

can anyone let me know how to use Radio Button List for the above requiremment?
Jitendra Faye replied to deepi singh on 16-Dec-11 04:36 AM
Implement SelectedIndexChanged event like this-

protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)


//write your code here


Try this and let me know.

Manish Mishra replied to deepi singh on 16-Dec-11 04:48 AM
you can use the below code
public RadioButtonList()
public class RadioButtonList : ListControl,
IRepeatInfoUser, INamingContainer, IPostBackDataHandler

for details of the properties, methods, events etc. follow the below post
kalpana aparnathi replied to deepi singh on 16-Dec-11 04:48 AM

Try this code:

<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
  protected void RadioButtonList1_SelectedIndexChanged(object sender, System.EventArgs e)
    Label1.Text = "Your favorite: " + RadioButtonList1.SelectedItem.Text;
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
  <title>How to use OnSelectedIndexChanged event in RadioButtonList</title>
  <form id="form1" runat="server">
    <h2 style="color:Maroon">RadioButtonList: OnSelectedIndexChanged</h2>
    <br /><br />
       Text="Color List"