Radio Button List control in asp.net
For Example: Write a program to demonstrate the use of radio button list control
.ASPX code
<html>
<head runat="server">
<title>Aryan Computers (Radio Button List) </title></head><body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Size="XX-Large"
ForeColor="#009933" Text="Example of Radio Button List"></asp:Label>
</div>
<asp:RadioButtonList ID="RadioButtonList1" runat="server">
<asp:ListItem>BCA I</asp:ListItem>
<asp:ListItem>BCA II</asp:ListItem>
<asp:ListItem>BCA III</asp:ListItem>
<asp:ListItem>PGDCA</asp:ListItem>
<asp:ListItem>MBA</asp:ListItem>
</asp:RadioButtonList>
<div style="margin-left: 120px">
<asp:Label ID="Label2" runat="server"></asp:Label>
<br />
<asp:Button ID="Button1" runat="server" Font-Bold="True" Height="38px"
onclick="Button1_Click" Text="Check" Width="76px" />
</div>
</form>
</body>
</html>
.ASPX.CS code
namespace WebApplication14
{
public partial class WebForm4 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Label2.Text = "You selected : " + RadioButtonList1.SelectedItem;
}
}
}
Output:
Comments
Post a Comment