Trouble with AssociatedControlID

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Frank_00001

    Trouble with AssociatedControlID

    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 AssociatedContr olID for a label, the width for the
    label gets ignored.
    2) When I assign the AssociatedContr olID 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 SelectedIndexCh anged 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="Defau lt2.aspx.cs"
    Inherits="Defau lt2" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>Untitl ed Page</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <asp:Label ID="lblToTextBo x" runat="server" Text="Text:"
    Width="100px" AssociatedContr olID="txtTextBo x"></asp:Label>
    <asp:TextBox ID="txtTextBox " runat="server"
    Width="100px"></asp:TextBox>
    <br />
    <asp:Label ID="lblDate" runat="server" Text="Date:" Width="100px"
    AssociatedContr olID="btnDate"> </asp:Label>
    <asp:Button ID="btnDate" runat="server" Text="" OnClick="btnDat e_Click"
    Width="100px" />
    <br />
    <asp:Label id="lblToDropDo wn" runat="server" Width="100px"
    AssociatedContr olID="ddlDropDo wn">Test:</asp:label>
    <asp:dropdownli st id="ddlDropDown " runat="server" Width="100px"
    AutoPostBack="T rue" OnSelectedIndex Changed="ddlDro pDown_SelectedI ndexChanged">
    <asp:ListItem Value="Select"> Select</asp:ListItem>
    <asp:ListItem Value="No">No</asp:ListItem>
    <asp:ListItem Value="Yes">Yes </asp:ListItem>
    </asp:dropdownlis t>
    </div>
    </form>
    </body>
    </html>
Working...