.NET Framework 4 - ASP.NET
ASP.NET Controls and Accessibility

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

By default, most ASP.NET server controls generate markup that conforms to accessibility guidelines. In some cases you must configure a control to make sure that it generates accessible markup. In a few cases, ASP.NET server controls cannot generate markup that conforms to certain accessibility guidelines.

The following sections list ASP.NET server controls and provide information about accessibility considerations that pertain to each control. If a control is not listed in this topic, it generates markup that conforms to current accessibility guidelines without any configuration requirements.

NoteNote

Past accessibility guidelines require all functionality of a Web site to be accessible without depending on client script. If you want to avoid the use of client script in order to conform to older guidelines, see ASP.NET Web Server Controls That Use Client Script.

For more information about accessibility guidelines and how to create ASP.NET Web pages that conform to them, see Accessibility in Visual Studio and ASP.NET.

This topic contains the following sections:

Standard Toolbox Controls

Control

Accessibility considerations

AdRotator

The Target property renders as a target attribute. The target attribute on anchor elements is not allowed in XHTML 1.1 or HTML 4.0.

If the controlRenderingCompatibilityVersion attribute of the pages element in the Web.config file is set to 3.5, the control renders a disabled attribute when the control's IsEnabled property is set to false. In HTML 4.0 and XHTML 1.1, the disabled attribute is allowed only for elements that are designed for user input. For more information, see WebControl..::.SupportsDisabledAttribute.

BulletedList

The Target property renders as a target attribute. The target attribute on anchor elements is not allowed in XHTML 1.1 or HTML 4.0.

Calendar

The control layout is rendered using an HTML table, which might not conform to some accessibility guidelines. For more information, see Accessibility in Visual Studio and ASP.NET. The table that is generated does not include thead or tbody elements.

To render a caption for the table, set the control's Caption and CaptionAlign properties.

If the controlRenderingCompatibilityVersion attribute of the pages element in the Web.config file is set to 3.5, the control renders a disabled attribute when the control's IsEnabled property is set to false. In HTML 4.0 and XHTML 1.1, the disabled attribute is allowed only for elements that are designed for user input. For more information, see WebControl..::.SupportsDisabledAttribute.

CheckBoxList

Setting the RepeatLayout property to Table (the default value) causes the control layout to be rendered by using an HTML table, which might not conform to some accessibility guidelines. For more information, see Accessibility in Visual Studio and ASP.NET.

DropDownList

The control does not support the optgroup element, which enables the list to be subdivided into sections.

If the controlRenderingCompatibilityVersion attribute of the pages element in the Web.config file is set to 3.5, the control renders a disabled attribute when the control's IsEnabled property is set to false. In HTML 4.0 and XHTML 1.1, the disabled attribute is allowed only for elements that are designed for user input. For more information, see WebControl..::.SupportsDisabledAttribute.

HyperLink

If you set the ImageUrl property to the URL of a graphic file, set the Text property to specify the alternate text for the resulting graphic.

The Target property renders as a target attribute. The target attribute on anchor elements is not allowed in XHTML 1.1 or HTML 4.0.

If the controlRenderingCompatibilityVersion attribute of the pages element in the Web.config file is set to 3.5, the control renders a disabled attribute when the control's IsEnabled property is set to false. In HTML 4.0 and XHTML 1.1, the disabled attribute is allowed only for elements that are designed for user input. For more information, see WebControl..::.SupportsDisabledAttribute.

Image, ImageButton, ImageMap

If the image conveys information, set the AlternateText property to an appropriate value. If the image is only decorative, set the GenerateEmptyAlternateText property to true to render an alt attribute that is set to an empty string (""), which causes screen readers to skip the graphic.

If the controlRenderingCompatibilityVersion attribute of the pages element in the Web.config file is set to 3.5, the control renders a disabled attribute when the control's IsEnabled property is set to false. In HTML 4.0 and XHTML 1.1, the disabled attribute is allowed only for elements that are designed for user input. For more information, see WebControl..::.SupportsDisabledAttribute.

Label

To use the control to render a label element for a text box or other control that is designed for user input, set the AssociatedControlID property to the ID of the control to associate with the label.

If the controlRenderingCompatibilityVersion attribute of the pages element in the Web.config file is set to 3.5, the control renders a disabled attribute when the control's IsEnabled property is set to false. In HTML 4.0 and XHTML 1.1, the disabled attribute is allowed only for elements that are designed for user input. For more information, see WebControl..::.SupportsDisabledAttribute.

LinkButton, Panel

If the controlRenderingCompatibilityVersion attribute of the pages element in the Web.config file is set to 3.5, the control renders a disabled attribute when the control's IsEnabled property is set to false. In HTML 4.0 and XHTML 1.1, the disabled attribute is allowed only for elements that are designed for user input. For more information, see WebControl..::.SupportsDisabledAttribute.

RadioButtonList

Setting the RepeatLayout property to Table (the default value) causes the control layout to be rendered by using an HTML table, which might not conform to some accessibility guidelines. For more information, see Accessibility in Visual Studio and ASP.NET.

Table, TableRow, TableCell, TableHeaderCell, TableHeaderRow, and TableFooterRow

To render a caption for the table, set the control's Caption and CaptionAlign properties.

When you create a Table object, include the TableHeaderRow and TableHeaderCell controls. The default values of the TableHeaderRow and TableFooterRow controls cause the control to render thead, tbody, and tfoot elements.

In TableCell controls, set the AssociatedHeaderCellID property to have the control render a header that associates the cell with its heading.

Set the control's Scope property to associate the header with the corresponding data column.

If the controlRenderingCompatibilityVersion attribute of the pages element in the Web.config file is set to 3.5, the control renders a disabled attribute when the control's IsEnabled property is set to false. In HTML 4.0 and XHTML 1.1, the disabled attribute is allowed only for elements that are designed for user input. For more information, see WebControl..::.SupportsDisabledAttribute.

Wizard

The control layout is rendered using an HTML table, which might not conform to some accessibility guidelines. For more information, see Accessibility in Visual Studio and ASP.NET. To create markup that uses cascading style sheets (CSS) for layout instead of a table, use the control's template properties.

If the controlRenderingCompatibilityVersion attribute of the pages element in the Web.config file is set to 3.5, the control renders a disabled attribute when the control's IsEnabled property is set to false. In HTML 4.0 and XHTML 1.1, the disabled attribute is allowed only for elements that are designed for user input. For more information, see WebControl..::.SupportsDisabledAttribute.

Data Toolbox Controls

Control

Accessibility considerations

DataList, DataListItem

The control layout is rendered using an HTML table, which might not conform to some accessibility guidelines. For more information, see Accessibility in Visual Studio and ASP.NET. To create markup that uses cascading style sheets (CSS) for layout instead of a table, use the ListView control.

If the controlRenderingCompatibilityVersion attribute of the pages element in the Web.config file is set to 3.5, the control renders a disabled attribute when the control's IsEnabled property is set to false. In HTML 4.0 and XHTML 1.1, the disabled attribute is allowed only for elements that are designed for user input. For more information, see WebControl..::.SupportsDisabledAttribute.

DataPager

If the pager-field objects are configured to use images, you cannot explicitly specify alternate text for the images. The images use the text properties (such as NextPageText) as the alternate text. As an alternative, use the TemplatePagerField object so that you can define exactly what the pager displays.

DetailsView

The control layout is rendered using an HTML table, which might not conform to some accessibility guidelines. For more information, see Accessibility in Visual Studio and ASP.NET. To create markup that uses cascading style sheets (CSS) for layout instead of a table, use the control's template properties.

If you create a ButtonField column and specify an image for the button, you cannot explicitly specify alternate text for the image. The image uses the button's Text property as the alternate text.

If you enable paging and you set the NextPageImageUrl and PreviousPageImageUrl properties, you cannot explicitly set the alternate text for the images that are used as paging buttons. Instead, use the PagerTemplate property so that you can define exactly what the pager displays.

Text boxes that are generated automatically when you set the control's AutoGenerateEditButton property to true have no associated label elements. To avoid this, create template fields and add your own Label and TextBox controls, and then create the association manually. To render a caption for the table, set the control's Caption and CaptionAlign properties.

If the controlRenderingCompatibilityVersion attribute of the pages element in the Web.config file is set to 3.5, the control renders a disabled attribute when the control's IsEnabled property is set to false. In HTML 4.0 and XHTML 1.1, the disabled attribute is allowed only for elements that are designed for user input. For more information, see WebControl..::.SupportsDisabledAttribute.

FormView

The control layout is rendered using an HTML table, which might not conform to some accessibility guidelines. For more information, see Accessibility in Visual Studio and ASP.NET. To create markup that uses cascading style sheets (CSS) for layout instead of a table, use the control's template properties.

Even if the control is customized with templates, the rendered markup is enclosed in an HTML table. To prevent this table element from being rendered, set the RenderOuterTable property to false. If you do this, you cannot set style properties such as ForeColor.

To render a caption for the table, set the control's Caption and CaptionAlign properties.

If the controlRenderingCompatibilityVersion attribute of the pages element in the Web.config file is set to 3.5, the control renders a disabled attribute when the control's IsEnabled property is set to false. In HTML 4.0 and XHTML 1.1, the disabled attribute is allowed only for elements that are designed for user input. For more information, see WebControl..::.SupportsDisabledAttribute.

GridView

Set the TableSection property of the HeaderRowproperty to TableHeader to cause thead and tbody elements to be generated.

Set the RowHeaderColumn property to the name of a data field and the UseAccessibleHeader property to true to have the control render th elements and scope attributes.

If you create a ButtonField object and specify an image for the button, you cannot explicitly specify alternate text for the image. The image uses the object's Text property as the alternate text.

To render a caption for the table, set the control's Caption and CaptionAlign properties.

If you enable paging and set the NextPageImageUrl and PreviousPageImageUrl properties, you cannot explicitly set the alternate text for the images that are used as paging buttons. Instead, use the PagerTemplate property so that you can define exactly what the pager displays.

Text boxes that are generated automatically when you set the control's AutoGenerateEditButton property to true have no associated label elements. To avoid this, create template columns and add your own Label and TextBox controls, and then create the association manually.

If the controlRenderingCompatibilityVersion attribute of the pages element in the Web.config file is set to 3.5, the control renders a disabled attribute when the control's IsEnabled property is set to false. In HTML 4.0 and XHTML 1.1, the disabled attribute is allowed only for elements that are designed for user input. For more information, see WebControl..::.SupportsDisabledAttribute.

ListView

If the controlRenderingCompatibilityVersion attribute of the pages element in the Web.config file is set to 3.5, the control renders a disabled attribute when the control's IsEnabled property is set to false. In HTML 4.0 and XHTML 1.1, the disabled attribute is allowed only for elements that are designed for user input. For more information, see WebControl..::.SupportsDisabledAttribute.

Validation Toolbox Controls

Control

Accessibility considerations

Validator controls

Set the Text and ErrorMessage properties to meaningful error messages. Do not set them to an asterisk (*).

ValidationSummary

If the controlRenderingCompatibilityVersion attribute of the pages element in the Web.config file is set to 3.5, the control renders a disabled attribute when the control's IsEnabled property is set to false. In HTML 4.0 and XHTML 1.1, the disabled attribute is allowed only for elements that are designed for user input. For more information, see WebControl..::.SupportsDisabledAttribute.

Navigation Toolbox Controls

Control

Accessibility considerations

Menu

If the controlRenderingCompatibilityVersion attribute of the pages element in the Web.config file is set to 3.5 or lower, or if the RenderingMode property is set to Table, the control layout is rendered using an HTML table, which might not conform to some accessibility guidelines. For more information, see Accessibility in Visual Studio and ASP.NET.

The control generates HTML that conforms with ARIA standards if the following conditions are true:

  • The controlRenderingCompatibilityVersion attribute of the pages element in the Web.config file is set to 4.0 or greater.

  • The Menu..::.RenderingMode property is set to MenuRenderingMode.Default or MenuRenderingMode.List.

To avoid markup validation errors, the ARIA attributes are set by using JavaScript. For more information about ARIA, see Accessibility in Visual Studio and ASP.NET.

The SkipLinkText property provides a way for the entire control to be skipped by screen readers. If the SkipLinkText property is set, an invisible image with alternate text is rendered, giving the user the option to jump to the end of the control. Screen readers read the alternate text aloud, and the image occupies only one pixel. You can set the SkipLinkText property to an empty string ("") to provide your own mechanism to skip the menu. The SkipLinkText property is set to "Skip Navigation Links" by default.

In browsers that do not support the full client-side functionality of the control, the browser will refresh the window to show the secondary navigation, which could cause screen readers to begin reading the page again.

If the controlRenderingCompatibilityVersion attribute of the pages element in the Web.config file is set to 3.5, the control renders a disabled attribute when the control's IsEnabled property is set to false. In HTML 4.0 and XHTML 1.1, the disabled attribute is allowed only for elements that are designed for user input. For more information, see WebControl..::.SupportsDisabledAttribute.

SiteMapPath

To have the control render the recommended skip navigation link, set the control's SkipLinkText property to a string .

In the site map XML file, set the description attribute of each site-map node to provide a title that screen readers can use to identify navigation links.

If the controlRenderingCompatibilityVersion attribute of the pages element in the Web.config file is set to 3.5, the control renders a disabled attribute when the control's IsEnabled property is set to false. In HTML 4.0 and XHTML 1.1, the disabled attribute is allowed only for elements that are designed for user input. For more information, see WebControl..::.SupportsDisabledAttribute.

TreeView

To a string to have the control render the recommended skip navigation link, set the control's SkipLinkText property.

Setting a node's PopulateOnDemand property to true causes the control to behave in a way that is incompatible with accessibility guidelines.

The Target property renders as a target attribute. In XHTML 1.1 or HTML 4.0, the target attribute is not allowed on anchor elements.

If the controlRenderingCompatibilityVersion attribute of the pages element in the Web.config file is set to 3.5, the control renders a disabled attribute when the control's IsEnabled property is set to false. In HTML 4.0 and XHTML 1.1, the disabled attribute is allowed only for elements that are designed for user input. For more information, see WebControl..::.SupportsDisabledAttribute.

Login Toolbox Controls

Control

Accessibility considerations

ChangePassword

The control layout is rendered using an HTML table, which might not conform to some accessibility guidelines. For more information, see Accessibility in Visual Studio and ASP.NET. To create markup that uses cascading style sheets (CSS) for layout instead of a table, use the control's template properties.

Even if the control is customized with templates, the rendered markup is enclosed in an HTML table. To prevent this table element from being rendered, set the RenderOuterTable property to false. If you do this, you cannot set style properties such as ForeColor.

If you configure the control to use images, set the corresponding text property to the appropriate alternate text. For example, if you set the ChangePasswordButtonType property to Image, set the ChangePasswordButtonText property to the alternate text value.

If the ChangePassword control is not customized with templates, the AccessKey property of the ChangePassword control applies to the first text box in the control. If the ChangePassword control is customized with templates, the AccessKey property is ignored. In that case, set the AccessKey property of each template child control directly.

The TabIndex property is rendered on all the TextBox controls in the ChangePassword control. If the ChangePassword control is customized with templates, the TabIndex property is ignored.

If the controlRenderingCompatibilityVersion attribute of the pages element in the Web.config file is set to 3.5, the control renders a disabled attribute when the control's IsEnabled property is set to false. In HTML 4.0 and XHTML 1.1, the disabled attribute is allowed only for elements that are designed for user input. For more information, see WebControl..::.SupportsDisabledAttribute.

CreateUserWizard

The control layout is rendered using an HTML table, which might not conform to some accessibility guidelines. For more information, see Accessibility in Visual Studio and ASP.NET. To create markup that uses cascading style sheets (CSS) for layout instead of a table, use the control's template properties.

If you configure the control to use images, set the corresponding text property to appropriate alternate text. For example, if you set the CancelButtonType property to Image, set the CancelButtonText property to alternate text.

Login

The control layout is rendered using an HTML table, which might not conform to some accessibility guidelines. For more information, see Accessibility in Visual Studio and ASP.NET. To create markup that uses cascading style sheets (CSS) for layout instead of a table, use the control's template properties.

Even if the control is customized with templates, the rendered markup is enclosed in an HTML table. To prevent this table element from being rendered, set the RenderOuterTable property to false. If you do this, you cannot set style properties such as ForeColor.

When the LoginButtonType property is set to Image, the value of the LoginButtonText property is used as the alternate text.

The control does not render access key or tab index settings.

If the controlRenderingCompatibilityVersion attribute of the pages element in the Web.config file is set to 3.5, the control renders a disabled attribute when the control's IsEnabled property is set to false. In HTML 4.0 and XHTML 1.1, the disabled attribute is allowed only for elements that are designed for user input. For more information, see WebControl..::.SupportsDisabledAttribute.

LoginName

Set the ToolTip property to text such as Logged in as user name so that screen readers will interpret the control's text correctly.

If the controlRenderingCompatibilityVersion attribute of the pages element in the Web.config file is set to 3.5, the control renders a disabled attribute when the control's IsEnabled property is set to false. In HTML 4.0 and XHTML 1.1, the disabled attribute is allowed only for elements that are designed for user input. For more information, see WebControl..::.SupportsDisabledAttribute.

LoginStatus

If the controlRenderingCompatibilityVersion attribute of the pages element in the Web.config file is set to 3.5, the control renders a disabled attribute when the control's IsEnabled property is set to false. In HTML 4.0 and XHTML 1.1, the disabled attribute is allowed only for elements that are designed for user input. For more information, see WebControl..::.SupportsDisabledAttribute.

PasswordRecovery

The control layout is rendered using an HTML table, which might not conform to some accessibility guidelines. For more information, see Accessibility in Visual Studio and ASP.NET. To create markup that uses cascading style sheets (CSS) for layout instead of a table, use the control's template properties.

Even if the control is customized with templates, the rendered markup is enclosed in an HTML table. To prevent this table element from being rendered, set the RenderOuterTable property to false. If you do this, you cannot set style properties such as ForeColor.

When the SubmitButtonType property is set to Image, the value of the SubmitButtonText property is used as the alternate text.

The control does not render access key or tab index settings.

If the controlRenderingCompatibilityVersion attribute of the pages element in the Web.config file is set to 3.5, the control renders a disabled attribute when the control's IsEnabled property is set to false. In HTML 4.0 and XHTML 1.1, the disabled attribute is allowed only for elements that are designed for user input. For more information, see WebControl..::.SupportsDisabledAttribute.

Web Parts Controls

Control

Accessibility considerations

AppearanceEditorPart, BehaviorEditorPart, CatalogZone

The control does not generate label elements to associate labels with controls.

All verbs generate the same link text.

Alternate text for links is rendered but is not customizable.

The control does not render access key or tab index settings.

EditorZone

When icons are displayed, all verbs display the same alternate text.

The control requires client script to function.

The control does not render access key or tab index settings.

The control does not generate label elements to associate labels with controls.

Alternate text for links is rendered but is not customizable.

LayoutEditorPart

You must include the LayoutEditorPart control with other Web Parts controls to make a page accessible. Otherwise, users can only use a mouse to drag Web Parts controls.

The control does not generate label elements to associate labels with controls.

All verbs generate the same link text.

Alternate text for links is rendered but is not customizable.

The control requires client script to function.

The control does not render access key or tab index settings.

PageCatalogPart, PropertyGridEditorPart, WebPartZone

The control does not generate label elements to associate labels with controls.

All verbs generate the same link text.

Alternate text for links is rendered but is not customizable.

The control does not render access key or tab index settings.

See Also

Concepts

Page view tracker