 |
ASP.NET and 508 Compliance.
[reply]
|
07/21/04 08:13 AM EST posted by alex email |
|
For those of you wishing to make your ASP.NET Applications 508 Compliance, or just wanted to have a more user friendly form with the use of Label tags with items other than Radio Buttons and Check Boxes, look no further.
One of the biggest drives of the applications I build for work is that based on a Government initiative, they must be 508 Compliant. This means that all Text that describes a forum element must be contained within a <label for="IDofFormElement"> tag. This is pretty easy right, well, if you use a page template the way I do, the template itself has a body control that all items within a page get added to, as a result all of my page's control's ids get prepended with _ctl0_ whatever... This made manual for attributes in the label tags difficult. Add to that, user controls with form elements inside of them with text in the calling page needing a label tag, you get the picture. Well, I requested and isntalled the Framework 1.1 June 2003 Hotfix Rollup. This hotfix includes a patch to help with the accessibility of Data Grids for 508 compliance, but something it also has but isn't mentioned often is the support for a new attribute on the ASP:Label tag.
Once you install this hotfix rollup, any text that needs to point to a form element just needs to be surrounded by an ASP:Label tag. So for example, just do
<asp:label runat="server" id="FirstnameLabel" AssociatedControlId="FirstName">First Name*:</asp:label>
will render as something like
<label for="_ctl0_FirstName">First Name*:</label>
For my example of a form element within a user control. Lets say your user control's ID is StartDate and your nested control ID within the user control is InputTextField. Then you would reference if from your HTML as
<asp:label runat="server" id="StartDateLabel" AssociatedControlId="StartDate:InputTextField">Start Date:</asp:label>
and that will render as
<label for="_ctl0_StartDate_InputTextField">Start Date*:</label>
So now even with .NET, there is no excuse not to make all of your apps accessible. |
|
|
|
This is a fantastic hotfix, thanks for the info Alex. Previously I was forced to write code-behind to set the "for" attribute of a label to the server control's "ClientID." And for some elements (DropdownList, I believe), I had to use "UniqueID" because the ClientID is incorrect at InitializeComponent/Page_Load.
But still no hotfix to allow client-side events for DropdownLists, eh? |
|
[reply]
|
07/26/04 12:59 PM EST posted by Doug web |
|
.NET obviously sux if they are just getting around to this... Don't even bother arguing it.
|
|
[reply]
|
08/23/05 05:51 AM EST posted by Michael |
|
Great input! I found more info on accessibility in ASP.NET and a
reference to your article here: Tips for improved accessibility in ASP.NET 1.1.
|
|
Note: Only registered ShinyDonkey.com users
can post images. Only administrators can delete images.