RadioButtonList Example in ASP.NET using C#

RadioButtonList Example in ASP.NET using C#


Posted in : ASP.Net Posted on : November 27, 2010 at 5:09 PM Comments : [ 0 ]

In this article we will introduce with RadioButtonList control in ASP.NET using C#.

RadioButtonList Example in ASP.NET using C#

RadioButtonList control in ASP.NET is used to select a RadioButton. You can make any number of RadioButton in RadioButtonList. In this example we make a RadioButtonList. If you want to perform operation on select item then you will true the EnableAutoPostBack. When user select an item from RadioButtonList the result will be displayed in Label.
 The user can edit item in RadioButtonList by clicking on Edit item.
 The following figure shows how can we add item in RadioButtonList.

RadioButtonList.aspx (Design Page):

RadioButtonList.aspx (source code):

<%@ Page Title="" Language="C#" MasterPageFile="~/RoseindiaMaster.master" 
AutoEventWireup="true"
CodeFile="RadioButtonList.aspx.cs" Inherits="RadioButtonList" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<style type="text/css">
.style2
{
font-size: x-large;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div>
<h2 style="color: Green">
RadioButtonList in ASP.NET 4 , C#</h2>
<strong><span class="style2">Which subject do you like?</span></strong>
<br />
<br />
<asp:RadioButtonList ID="RadioButtonList1" runat="server" 
AutoPostBack="true" Font-Bold="True"
Font-Names="Trebuchet MS" ForeColor="#333300" 
OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged">
<asp:ListItem>Hindi</asp:ListItem>
<asp:ListItem>English</asp:ListItem>
<asp:ListItem>Sanskrit</asp:ListItem>
<asp:ListItem>Mathematices</asp:ListItem>
<asp:ListItem>Physics</asp:ListItem>
<asp:ListItem>Chemistry</asp:ListItem>
<asp:ListItem>Biology</asp:ListItem>
<asp:ListItem>Account</asp:ListItem>
<asp:ListItem>History</asp:ListItem>
<asp:ListItem>Sociology</asp:ListItem>
<asp:ListItem>Geology</asp:ListItem>
<asp:ListItem>Computer science</asp:ListItem>
</asp:RadioButtonList>
<br />
<asp:Label ID="Label1" runat="server" Font-Bold="True" 
Font-Size="Large" ForeColor="#000099"></asp:Label>
</div>
</asp:Content>

Output:

Download source code
Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics