ASP.NET RadioButtonList 控件
定義和用法
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
ListControl 控件包括列表控件的所有基本功能。繼承自此控件的控件包括:CheckBoxList, DropDownList, ListBox 以及 RadioButtonList 控件。
如需完整描述,請訪問 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 控件中。
上一篇: ASP.NET RequiredFieldValidator 控件 下一篇: ASP.NET Table 控件