?
本文檔使用 PHP中文網(wǎng)手冊 發(fā)布
RadioButtonList 控件用于創(chuàng)建單選按鈕組。
RadioButtonList 控件中的每個可選項是通過 ListItem 元素來定義的!
提示:該控件支持數(shù)據(jù)綁定!
屬性 | 描述 | .NET |
---|---|---|
CellPadding | 單元格邊框與內(nèi)容之間的像素數(shù)。 | 1.0 |
CellSpacing | 表格單元格之間的像素數(shù)。 | 1.0 |
RepeatColumns | 當顯示單選按鈕組時要使用的列數(shù)。 | 1.0 |
RepeatDirection | 規(guī)定單選按鈕組應水平重復還是垂直重復。 | 1.0 |
RepeatLayout | 單選按鈕組的布局。 | 1.0 |
runat | 規(guī)定該控件是服務器控件。必須設置為 "server"。 | 1.0 |
TextAlign | 文本應出現(xiàn)在單選按鈕的哪一側(cè)(左側(cè)還是右側(cè))。 | 1.0 |
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.
AccessKey,?Attributes,?BackColor,?BorderColor,?BorderStyle,?BorderWidth,?CssClass,?Enabled,?Font,?EnableTheming,?ForeColor,?Height,?IsEnabled,?SkinID,?Style,?TabIndex,?ToolTip,?Width
AppRelativeTemplateSourceDirectory,?BindingContainer,?ClientID,?Controls,?EnableTheming,?EnableViewState,?ID,?NamingContainer,?Page,?Parent,?Site,?TemplateControl,?TemplateSourceDirectory,?UniqueID,?Visible
RadiobuttonList
<script??runat="server"> Sub?submit(sender?As?Object,?e?As?EventArgs) ???label1.Text="You?selected?"?&?radiolist1.SelectedItem.Text End?Sub </script> <!DOCTYPE?html> <html> <body> <form?runat="server"> <asp:RadioButtonList?id="radiolist1"?runat="server"> ???<asp:ListItem?selected="true">Item?1</asp:ListItem> ???<asp:ListItem>Item?2</asp:ListItem> ???<asp:ListItem>Item?3</asp:ListItem> ???<asp:ListItem>Item?4</asp:ListItem> </asp:RadioButtonList> <br> <asp:Button?text="Submit"?OnClick="submit"?runat="server"/> <p><asp:Label?id="Label1"?runat="server"/></p> </form> </body> </html>
在本例中,我們在 .aspx 文件中聲明了一個 RadioButtonList 控件,一個 Button 控件,以及一個 Label 控件。然后,我們創(chuàng)建了一個事件句柄,當發(fā)生 Click 事件時,會把文本和被選項目顯示在 Label 控件中。