Re: How to create section 508 compliant Data Grid - ASP.NET v1.1
- From: "addup" <adi.jog@xxxxxxxxx>
- Date: 21 Jun 2006 10:40:40 -0700
vMike wrote:
"Corey B" <corey.burnett@xxxxxxxxx> wrote in message
news:1150902201.873281.25390@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I have a data grid that has three columns: First Name, Middle Name,I have never looked at it that much but there is an accessibilty section in
and Last Name. The grid has a list of people with a blank row at the
bottom of the grid (in the footer) that allows the user to add a new
person to the list. There is also an Edit button at the end of each
row that allows the user to edit a particular row. So far - no problem
- easy to do.
I have been asked to make the grid section 508 compliant. The
requirement is that the column headers must have labels that reference
the text boxes in the footer row. On a normal web form it would look
like this:
<label for="txtFirstName">First Name</label>
<asp:textbox id="txtFirstName" runat="server" />
This allows a text reader to figure out that the words "First Name" are
associated with the text box "txtFirstName" and helps a blind person
understand how to fill out the form.
Now, back to my problem. I need to figure out a way to get the header
of a Data Grid column to work the same way. The biggest problem is
that I have no idea what the ClientID of the textbox will be. So I
definitely can't hard code the <label> item.
Does anyone have any idea how I can do this?
Thanks,
Corey
the sdk doc. It makes reference to a gridview property call
UseAccessibleHeader. Maybe that will help or you might search the docs for
Accessibility Support in ASP.NET or ASP.NET Controls and Accessibility
Mike
Or do it the hard way (for framework 1.x).
example:
If your column is defined as
<ASP:TEMPLATECOLUMN>
<HEADERTEMPLATE><ASP:LABEL Runat="server" ID="lblHeaderLabel" >Name
Column</ASP:LABEL></HEADERTEMPLATE>
<ITEMTEMPLATE>…</ITEMTEMPLATE>
<EDITITEMTEMPLATE>…</EDITITEMTEMPLATE>
<FOOTERTEMPLATE><INPUT runat="server" id="txtFoot"
class="raTextBox"></FOOTERTEMPLATE>
</ASP:TEMPLATECOLUMN>
your datagrid ItemDataBound handler can then do something analogus to
(VB example)
Static lblHeaderLabel As System.Web.UI.WebControls.Label
Dim txtFoot As HtmlControls.HtmlInputText
Try
Select Case e.Item.ItemType
Case ListItemType.Header
lblHeaderLabel = e.Item.FindControl("lblHeaderLabel")
Case ListItemType.Footer
txtFoot = e.Item.FindControl("txtFoot")
If Not lblHeaderLabel Is Nothing AndAlso _
Not txtFoot Is Nothing Then
lblHeaderLabel.Text = "<LABEL for='" & txtFoot.ClientID
& "'>Name Column</LABEL>"
End If
End Select
Catch ex As Exception : DisplayError(ex)
End Try
Hope this helps
--- a ---
.
- Follow-Ups:
- References:
- Prev by Date: Re: Textboxes are rendered wider than other input controls
- Next by Date: Re: Convert from C# into VB
- Previous by thread: Re: How to create section 508 compliant Data Grid - ASP.NET v1.1
- Next by thread: Re: How to create section 508 compliant Data Grid - ASP.NET v1.1
- Index(es):
Relevant Pages
|