Latest web development tutorials

ASP.NET RadioButtonList 控件

Web Server Controls Web服務器控件

定義和用法

RadioButtonList 控件用於創建單選按鈕組。

RadioButtonList 控件中的每個可選項是通過ListItem 元素來定義的!

提示:該控件支持數據綁定!


屬性

属性 描述 .NET
CellPadding 单元格边框与内容之间的像素数。 1.0
CellSpacing 表格单元格之间的像素数。 1.0
RepeatColumns 当显示单选按钮组时要使用的列数。 1.0
RepeatDirection 规定单选按钮组应水平重复还是垂直重复。 1.0
RepeatLayout 单选按钮组的布局。 1.0
runat 规定该控件是服务器控件。必须设置为 "server"。 1.0
TextAlign 文本应出现在单选按钮的哪一侧(左侧还是右侧)。 1.0

ListControl 標準屬性

AppendDataBoundItems, AutoPostBack, CausesValidation, DataTextField, DataTextFormatString, DataValueField, Items, runat, SelectedIndex, SelectedItem, SelectedValue, TagKey, Text, ValidationGroup, OnSelectedIndexChanged

The ListControl control covers all the base functions for list controls. Controls that inherits from this control include the CheckBoxList, DropDownList, ListBox, and RadioButtonList controls.

如需完整描述,請訪問ListControl標準屬性

Web 控件標準屬性

AccessKey, Attributes, BackColor, BorderColor, BorderStyle, BorderWidth, CssClass, Enabled, Font, EnableTheming, ForeColor, Height, IsEnabled, SkinID, Style, TabIndex, ToolTip, Width

如需完整描述,請訪問Web控件標準屬性

控件標準屬性

AppRelativeTemplateSourceDirectory, BindingContainer, ClientID, Controls, EnableTheming, EnableViewState, ID, NamingContainer, Page, Parent, Site, TemplateControl, TemplateSourceDirectory, UniqueID, Visible

如需完整描述,請訪問控件標準屬性


實例

RadiobuttonList
在本例中,我們在.aspx 文件中聲明了一個RadioButtonList 控件,一個Button 控件,以及一個Label 控件。 然後,我們創建了一個事件句柄,當發生Click 事件時,會把文本和被選項目顯示在Label 控件中。


Web Server Controls Web服務器控件