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 伺服器控件