-->
<asp:RadioButton ID="rdlMagazine" Text="Magazine Article" runat="server" />
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RadioButtonDemo01.aspx.cs" Inherits="LearnAsp.Net.Control.RadioButton.RadioButtonDemo01" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> How did you hear about our Website? <ul> <li> <asp:RadioButton ID="rdlSocialMedia" Text="Socail Media Sites" GroupName="Source" runat="server" /> </li> <li> <asp:RadioButton ID="rdlMagazine" Text="Magazine Article" GroupName="Source" runat="server" /> </li> <li> <asp:RadioButton ID="rdlTelevision" Text="Television Program" GroupName="Source" runat="server" /> </li> <li> <asp:RadioButton ID="rdlInternetAdd" Text="Internet Advertise" GroupName="Source" runat="server" /> </li> <li> <asp:RadioButton ID="rblNewPaper" Text="News Paper" GroupName="Source" runat="server" /> </li> <li> <asp:RadioButton ID="rdlOther" Text="Other Source" GroupName="Source" runat="server" /> </li> </ul> <asp:Button ID="btnSubmit" Text="Submit" runat="server" OnClick="btnSubmit_Click" /> <hr /> <asp:Label ID="lblResult" runat="server" /> </div> </form> </body> </html>
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace LearnAsp.Net.Control.RadioButton { public partial class RadioButtonDemo01 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void btnSubmit_Click(object sender, EventArgs e) { if (rdlSocialMedia.Checked) lblResult.Text = rdlSocialMedia.Text; if (rblNewPaper.Checked) lblResult.Text = rblNewPaper.Text; if (rdlMagazine.Checked) lblResult.Text = rdlMagazine.Text; if (rdlInternetAdd.Checked) lblResult.Text = rdlInternetAdd.Text; if (rdlTelevision.Checked) lblResult.Text = rdlTelevision.Text; if (rdlOther.Checked) lblResult.Text = rdlOther.Text; } } }
Thanks for reading Asp.Net RadioButton Control
Please do not enter any spam link in the comment box.
No comments:
Post a Comment
Please do not enter any spam link in the comment box.