System.Web.UI.WebControls.RadioButtonList Class

Represents a list control that encapsulates a group of radio button controls.

See Also: RadioButtonList Members

Syntax

[System.Web.UI.SupportsEventValidation]
[System.Web.UI.ValidationProperty("SelectedItem")]
public class RadioButtonList : ListControl, System.Web.UI.INamingContainer, System.Web.UI.IPostBackDataHandler, IRepeatInfoUser

Remarks

In this topic:

Introduction

The System.Web.UI.WebControls.RadioButtonList control provides page developers with a single-selection radio button group that can be dynamically generated through data binding. It contains an ListControl.Items collection with members that correspond to individual items on the list. To determine which item is selected, test the ListControl.SelectedItem property of the list.

Specifying List Layout

You can specify how the list is rendered by setting the RadioButtonList.RepeatLayout and RadioButtonList.RepeatDirection properties. For information about layout options, see the System.Web.UI.WebControls.RepeatLayout enumeration.

By default, RadioButtonList.RepeatDirection is set to RepeatDirection.Vertical. Setting this property to RepeatDirection.Horizontal causes the control to render the list horizontally. Some RadioButtonList.RepeatLayout settings do not allow horizontal layout. For more information, see the System.Web.UI.WebControls.RepeatLayout enumeration.

Note:

This control can be used to display user input, which might include malicious client script. Check any information that is sent from a client for executable script, SQL statements, or other code before displaying it in your application. You can use validation controls to verify user input before displaying the input text in a System.Web.UI.WebControls.RadioButtonList control. ASP.NET provides an input request validation feature to block script and HTML in user input. For more information, see Securing Standard Controls, How to: Protect Against Script Exploits in a Web Application by Applying HTML Encoding to Strings, and Introduction to Validating User Input in ASP.NET Web Pages.

Accessibility

For information about how to configure this control so that it generates markup that conforms to accessibility standards, see Accessibility in Visual Studio 2010 and ASP.NET 4 and ASP.NET Controls and Accessibility.

Declarative Syntax

Example

<asp:RadioButtonList
    AccessKey="string"
    AppendDataBoundItems="True|

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0