I'm having a little trouble with the 508 Accessibility Compliance, relating
labels and with DropDowns, from an XHTML source.
1) When I assign the AssociatedControlID for a label, the width for the
label gets ignored.
2) When I assign the AssociatedControlID for a label to a DropDown, and a
user clicks on that label the focus is assigned to the dropdown, the dropdown
loses the selected value and does not send a SelectedIndexChanged back to the
server. This is causing me trouble since I need to make certain fields
available or restricted based on the dropdown and user selected values can be
lost.
Has anyone else run in to this, and does anyone know a work around?
The ASPX source example...
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs"
Inherits="Default2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="lblToTextBox" runat="server" Text="Text:"
Width="100px" AssociatedControlID="txtTextBox"></asp:Label>
<asp:TextBox ID="txtTextBox" runat="server"
Width="100px"></asp:TextBox>
<br />
<asp:Label ID="lblDate" runat="server" Text="Date:" Width="100px"
AssociatedControlID="btnDate"></asp:Label>
<asp:Button ID="btnDate" runat="server" Text="" OnClick="btnDate_Click"
Width="100px" />
<br />
<asp:Label id="lblToDropDown" runat="server" Width="100px"
AssociatedControlID="ddlDropDown">Test:</asp:label>
<asp:dropdownlist id="ddlDropDown" runat="server" Width="100px"
AutoPostBack="True" OnSelectedIndexChanged="ddlDropDown_SelectedIndexC hanged">
<asp:ListItem Value="Select">Select</asp:ListItem>
<asp:ListItem Value="No">No</asp:ListItem>
<asp:ListItem Value="Yes">Yes</asp:ListItem>
</asp:dropdownlist>
</div>
</form>
</body>
</html>