asp:RadioButtonList control
RadioButton List Control is a control that stores the radioboots, all one person <input type = radio> </ input>
RadioButton List Control is a control that groups a collection of radibutts, all are provided through an individual <input type = radio> </ input>. Its properties like backcroll, foreclosure, border collar, border style, borderwidth, height etc.
Following are some important properties that are very useful.
(RadioButtonList controls supports the same set of properties as the CheckBoxList control does.
SelectedValue | Get the value first selected item. |
SelectedIndex | Gets or Sets the index of the first selected item. |
SelectedItem | Gets the first selected item |
TextAlign | Gets or Sets the alignment of the radiobutton text. |
DataTextField | Name of the data source field to supply the text of the items. (No need to set when you are adding items directly into .aspx page.) |
DataValueField | The name of the data source field to supply the value of the items. (You do not need to set things when you are adding things directly to an .aspx page.) |
DataSourceID | To provide data, the ID of the data source component (only when you have a data source component on the page, such as SqlDataSource, AccessDataSource etc.) |
DataSource | The data source that populates items in the radiobotellist (usually when you dynamically produce objects from the database). |
AutoPostBack | true/false. If true, the form is automatically posted back to the server when user click any of the radiobutton. It will also fire OnSelectedIndexChanged method. |
AppendDataBoundItems | right wrong. If true, fixed items added (added from .aspx page) are dynamically cleared (by the code behind the file) or items are cleaned. |
OnSelectedIndexChanged | Method name that fires when user click any of the radiobutton in the list. (Fires only when AutoPostBack=true.) |
Items | Gets the colleciton of the items from the list. |
RepeatLayout | table/flow. Gets or Set the layout of the radiobuttons when rendered to the page. |
RepeatColumns | Get or Sets the no. of columns to display when the control is rendered. |
RepeatDirection | Vertical horizontal To indicate whether the control will be presented horizontally or vertically, receives value or sets |
|
// 1st RadioButtonList <asp:RadioButtonList ID="RadioButtonList1" runat="Server"> <asp:ListItem Text="Red" Value="red"></asp:ListItem> <asp:ListItem Text="Blue" Value="blue"></asp:ListItem> <asp:ListItem Text="Green" Value="green"></asp:ListItem> </asp:RadioButtonList> // 2nd RadioButtonList <asp:RadioButtonList ID="RadioButtonRunTime" runat="server" /> // 3rd RadioButtonList <asp:RadioButtonList ID="RadioButonListBind" runat="Server" DataTextField="Name" DataValueField="ID" /> // 4th RadioButtonList <asp:RadioButtonList ID="RadioButtonListBoundFire" runat="Server" DataTextField="Name" DataValueField="ID" OnSelectedIndexChanged="FireOnSelectedIndexChangd" AutoPostBack="true" />
0 comments:
Post a Comment