NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

RadioButtonList Web Control

The RadioButtonList control provides a radio button group that can be dynamically generated via databinding. The radio buttons in the list are mutually exclusive.

Note   You can also use the RadioButton control. The RadioButtonList control is easier for data binding, while the individual RadioButton control gives you greater control over the layout of the controls.

ASP+ Syntax

A RadioButtonList control can include individual list items that declare the check boxes to include in the list. You can declare as many list items as you like.

Required properties are noted in boldface type.

<asp:RadioButtonList id="RadioButtonList1" runat="server"
   AutoPostBack="True|False"
   CellPadding="Pixels"
   DataSource="<% databindingexpression  %>"
   DataTextField="DataSourceField"
   DataValueField="DataSourceField"
   RepeatColumns="ColumnCount"
   RepeatDirection="Vertical|Horizontal"
   RepeatLayout="Flow|Table"
   TextAlign="Right|Left"
   OnSelectedIndexChanged="OnSelectedIndexChangedMethod"
/>
   <asp:ListItem text="label" value="value" selected="True|False" />
</asp:RadioButtonList>

Properties

Property Description
(Base control properties) The properties defined in Base Web Control Properties.
AutoPostBack true if client-side changes in the control automatically cause a postback to the server; false otherwise. The default is false.
CellPadding The amount of space, in pixels, between radio buttons.

When programming, this property is set using Units.

DataSource A data-binding expression that references any object that supports the ICollection interface.
Note   In ASP+ syntax, it is preferable to include the data-binding expression in single quotation marks to accommodate quoted expressions.
DataTextField The field or property of the object in DataSource that will be the source of data for the Text property of individual list items.
DataValueField The field or property of the object in DataSource that will be the source of data for the Value property of individual list items.
Items A collection of ListItem objects representing individual items within the list of radio buttons.

This property is only used when programming. At design time, you set this property by declaring <asp:ListItem> items.

RepeatColumns The number of columns to use to display the radio buttons. The default is 1.
RepeatDirection The direction in which radio button are displayed in the list. If Vertical, the radio buttons are ordered top to bottom, like text in a newspaper. If Horizontal, radio buttons are ordered left-to-right, like days in a calendar. This property has no effect if RepeatColumns is set to 1. The default is Vertical.

When programming, this property is set using the RepeatDirection enumeration.

RepeatLayout Indicates whether control renders in-line (Flow) or in a table (Table). The default is Table.

When programming, this property is set using the RepeatLayout enumeration.

SelectedIndex Ordinal index of currently selected radio button in the list.

This property is only used when programming. At design time, you set this property by including a Selected property in a ListItem element.

SelectedItem Reference to the Value property of the currently-selected radio button in the list.

This property is only used when programming. At design time, you set this property by including a Selected property in a ListItem element.

TextAlign The position of the caption with respect to the radio button. The default is Right.

When programming, you set this property using the TextAlign enumeration.

Events

Event (and paramters) Description
OnSelectedIndexChanged(Object sender, EventArgs e) Raised on the server when a check box in the list is selected. This event does not cause the Web Forms page to be posted to the server unless the AutoPostBack property is set to true.

The e events argument object has no properties.

Example

To be supplied.

See Also

Web Forms Controls by Function |