RadioButtonList
Previous | Home | Next |
The RadioButtonList Web server control is used to display a list of radio buttons. This control provides us with a single-selection radio button group that can be dynamically generated via data binding. The Items property of this control allows us to add items to the control. To determine which item is selected, we need to test the SelectedItem property of the list. The class hierarchy of this control is as follows: Object Control WebControl ListControl RadioButtonList Some Properties: 1.Items ::Gets/Sets the collection of items in the list 2.RepeatColumns ::Gets/Sets the number of displayed columns in the radio button list 3.RepeatDirection ::Gets/Sets the display direction of radio buttons 4.RepeatLayout ::Gets/Sets the radio button layout 5.TextAlign ::Gets/Sets the radio button's text alignment
RadioButtonList ********************************************************************** <%@ Page Language="C#" AutoEventWireup="true" CodeFile="RadiobuttonList.aspx.cs" Inherits="_Default" %>*********************************************************************** CS Code *********************************************************************** using System; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Submit_Click(object sender, EventArgs e) { Show.Text = "You have Selected::" +Subjects.SelectedItem.Text.ToString(); } protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e) { } }RadioButtonList
Previous | Home | Next |