如何创建符合Section 508的数据网格 - ASP.NET v1.1 [英] How to create section 508 compliant Data Grid - ASP.NET v1.1

查看:61
本文介绍了如何创建符合Section 508的数据网格 - ASP.NET v1.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含三列的数据网格:名字,中间名,

和姓氏。网格有一个人物列表,在网格底部(在页脚中)有一个空行,允许用户在列表中添加一个新的

人。每个

行末尾还有一个编辑按钮,允许用户编辑特定行。到目前为止 - 没问题

- 很容易做到。


我被要求使网格部分符合508。

要求是列标题必须具有引用页脚行中文本框的标签。在正常的网络表单上,它看起来像这样:b $ b< label for =" txtFirstName"> First Name< / label>

< asp:textbox id =" txtFirstName" RUNAT = QUOT;服务器" />


这允许文本阅读器找出单词First Name。

与文本框txtFirstName相关联并帮助盲人

了解如何填写表格。


现在,回到我的问题。我需要找到一种方法来获取数据网格列的标题

以相同的方式工作。最大的问题是

,我不知道文本框的ClientID是什么。所以我

肯定不能硬编码< label>项目。


有谁知道我怎么做这个?


谢谢,

Corey

I have a data grid that has three columns: First Name, Middle Name,
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

推荐答案



" Corey B" <共*********** @ gmail.com>在消息中写道

news:11 ********************* @ y41g2000cwy.googlegro ups.com ...

"Corey B" <co***********@gmail.com> wrote in message
news:11*********************@y41g2000cwy.googlegro ups.com...
我有一个包含三列的数据网格:名字,中间名,
和姓氏。网格有一个人员列表,在网格底部(在页脚中)有一个空行,允许用户在列表中添加新的人员。每个
行的末尾还有一个Edit按钮,允许用户编辑特定的行。到目前为止 - 没问题
- 很容易做到。

我被要求使网格部分508符合要求。
要求是列标题必须具有引用页脚行中文本框的标签。在正常的网络表单上,它看起来像这样:

< label for =" txtFirstName">名字< / label>
< asp:textbox id = QUOT; txtFirstName" RUNAT = QUOT;服务器" />

这允许文本阅读器找出单词First Name。
与文本框txtFirstName相关联。并帮助盲人了解如何填写表格。

现在,回到我的问题。我需要找到一种方法来使数据网格列的标题以相同的方式工作。最大的问题是
我不知道文本框的ClientID是什么。所以我
肯定不能硬编码< label>项目。

有谁知道我怎么能这样做?

谢谢,
Corey
I have a data grid that has three columns: First Name, Middle Name,
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



我有从来没有看过那么多,但是在sdk doc中有一个可访问的部分

。它引用了gridview属性调用

UseAccessibleHeader。也许这会有所帮助,或者你可以在文档中搜索

ASP.NET或ASP.NET控件和辅助功能中的辅助功能支持


Mike


I have never looked at it that much but there is an accessibilty section in
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


vMike写道:
" Corey B" <共*********** @ gmail.com>在消息中写道
新闻:11 ********************* @ y41g2000cwy.googlegro ups.com ...
"Corey B" <co***********@gmail.com> wrote in message
news:11*********************@y41g2000cwy.googlegro ups.com...
I有一个数据网格有三列:名字,中间名,
和姓氏。网格有一个人员列表,在网格底部(在页脚中)有一个空行,允许用户在列表中添加新的人员。每个
行的末尾还有一个Edit按钮,允许用户编辑特定的行。到目前为止 - 没问题
- 很容易做到。

我被要求使网格部分508符合要求。
要求是列标题必须具有引用页脚行中文本框的标签。在正常的网络表单上,它看起来像这样:

< label for =" txtFirstName">名字< / label>
< asp:textbox id = QUOT; txtFirstName" RUNAT = QUOT;服务器" />

这允许文本阅读器找出单词First Name。
与文本框txtFirstName相关联。并帮助盲人了解如何填写表格。

现在,回到我的问题。我需要找到一种方法来使数据网格列的标题以相同的方式工作。最大的问题是
我不知道文本框的ClientID是什么。所以我
肯定不能硬编码< label>项目。

有谁知道我怎么能这样做?

谢谢,
Corey
I have a data grid that has three columns: First Name, Middle Name,
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


我从来没有看过它那么多,但是在sdk doc中有一个可访问的部分。它引用了gridview属性调用
UseAccessibleHeader。也许这会有所帮助,或者您可以在ASP.NET或ASP.NET控件和辅助功能中搜索文档以获取辅助功能支持

Mike


I have never looked at it that much but there is an accessibilty section in
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




或者做得很难(对于框架1.x)。


示例:

如果您的列被定义为

< ASP:TEMPLATECOLUMN>

< HEADERTEMPLATE>< ASP:LABEL Runat =" server" ID = QUOT; lblHeaderLabel" >名称

列< / ASP:LABEL>< / HEADERTEMPLATE>

< ITEMTEMPLATE>& hellip;< / ITEMTEMPLATE>

< EDITITEMTEMPLATE>& hellip;< / EDITITEMTEMPLATE>

< FOOTERTEMPLATE>< INPUT runat =" server" id =" txtFoot"

class =" raTextBox">< / FOOTERTEMPLATE>

< / ASP:TEMPLATECOLUMN>


你的datagrid ItemDataBound处理程序然后可以做类似的事情

(VB示例)

静态lblHeaderLabel As System.Web.UI.WebControls.Label

Dim txtFoot As HtmlControls.HtmlInputText

尝试

选择案例e.Item.ItemType

Case ListItemType.Header

lblHeaderLabel = e.Item.FindControl(" lblHeaderLabel")

Case ListItemType.Footer

txtFoot = e.Item.FindControl(" txtFoot")

如果不是lblHeaderLabel什么也没有_

不txtFoot什么都没有那么

lblHeaderLabel.Text ="< LABEL for =''" ; &安培; txtFoot.ClientID

& "''>名称列< / LABEL>"

结束如果

结束选择

Catch ex As Exception:DisplayError(ex )

结束尝试

希望这有帮助

--- a ---



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>&hellip;</ITEMTEMPLATE>
<EDITITEMTEMPLATE>&hellip;</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 ---




addup写道:

addup wrote:

或者这么做(框架1.x)。
示例:
如果您的列定义为
< ASP:TEMPLATECOLUMN>
< HEADERTEMPLATE>< ASP:LABEL Runat =" server" ID = QUOT; lblHeaderLabel" >名称
列< / ASP:LABEL>< / HEADERTEMPLATE>
< ITEMTEMPLATE>& hellip;< / ITEMTEMPLATE>
< EDITITEMTEMPLATE>& hellip;< / EDITITEMTEMPLATE>
< FOOTERTEMPLATE>< INPUT runat =" server" id =" txtFoot"
class =" raTextBox">< / FOOTERTEMPLATE>
< / ASP:TEMPLATECOLUMN>

你的datagrid ItemDataBound处理程序可以做一些事情类似于
(VB示例)

静态lblHeaderLabel As System.Web.UI.WebControls.Label
Dim txtFoot As HtmlControls.HtmlInputText
尝试
选择案例e.Item.ItemType
案例ListItemType.Header
lblHeaderLabel = e.Item.FindControl(" lblHeaderLabel")
案例ListItemType.Footer
txtFoot = e.Item.FindControl (" txtFoot")
如果不是lblHeaderLabel什么也没有_
不txtFoot什么都没有那么
lblHeaderLabel.Text ="< LABEL for =''" &安培; txtFoot.ClientID
& "''>名称列< / LABEL>"
结束如果
结束选择
Catch ex As Exception:DisplayError(ex)
结束尝试

希望这有帮助
--- a ---

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>&hellip;</ITEMTEMPLATE>
<EDITITEMTEMPLATE>&hellip;</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 ---




谢谢 - 我认为我现在接近解决方案了。我发现

ASP.NET v1.1 SP1已经为一个名为

AssociatedControlID的标签添加了一个属性。如果您有以下内容:


< asp:label id =" myLabel" runat =" server"

AssociatedControlID =" myTextBox"> First Name"< / asp:label>

< asp:TextBox id =" myTextBox" ; RUNAT = QUOT;服务器" />


然后,ASP.NET将吐出以下内容:

< label for =" myTextBox"> First Name< / label>


即使

文本框是嵌套控件,它也能够发出正确的客户端ID。


所以这是我的问题。假设我有这个设置:


< ASP:TEMPLATECOLUMN>

< HEADERTEMPLATE>

< ; ASP:LABEL Runat =" server" ID = QUOT; lblHeaderLabel" >姓名

栏< / ASP:LABEL>

< / HEADERTEMPLATE>

< ITEMTEMPLATE>& hellip;< / ITEMTEMPLATE>

< EDITITEMTEMPLATE>& hellip;< / EDITITEMTEMPLATE>

< FOOTERTEMPLATE>

< ASP:TEXTBOX ID = " txtInput" RUNAT = QUOT;服务器" />

< / FOOTERTEMPLATE>

< / ASP:TEMPLATECOLUMN>


不知何故我需要添加AssociatedControlID属性为

lblHeaderLabel标签控件,以使其引用txtInput

文本框。所以我不确定在哪里添加代码。它应该进入ItemDataBound中的

标头处理程序还是应该进入页脚处理程序?

好​​像我把它放在标题处理程序中我不会能够

引用一个存在于页脚中的控件。但是,如果我把它放在页脚处理程序的
中,我将无法修改一个控件,它位于页眉的
中。任何帮助将不胜感激。


谢谢,

科瑞



Thanks - I think that I am close to a solution now. I found that
ASP.NET v1.1 SP1 has added a property to a label called
AssociatedControlID. If you have the following:

<asp:label id="myLabel" runat="server"
AssociatedControlID="myTextBox">First Name"</asp:label>
<asp:TextBox id="myTextBox" runat="server" />

Then ASP.NET will spit out the following:
<label for="myTextBox">First Name</label>

And it''s smart enough that it will emit the proper client id even if
the text box is a nested control.

So here''s my problem. Let''s say I have this set up:

<ASP:TEMPLATECOLUMN>
<HEADERTEMPLATE>
<ASP:LABEL Runat="server" ID="lblHeaderLabel" >Name
Column</ASP:LABEL>
</HEADERTEMPLATE>
<ITEMTEMPLATE>&hellip;</ITEMTEMPLATE>
<EDITITEMTEMPLATE>&hellip;</EDITITEMTEMPLATE>
<FOOTERTEMPLATE>
<ASP:TEXTBOX ID="txtInput" RUNAT="Server" />
</FOOTERTEMPLATE>
</ASP:TEMPLATECOLUMN>

Somehow I need to add the AssociatedControlID property to the
lblHeaderLabel label control to get it to reference the txtInput
textbox. So I am not sure where to add the code. Should it go in the
header handler in ItemDataBound or should it go in the footer handler?
It seems like if I put it in the header handler I wouldn''t be able to
reference a control that lives in the footer yet. But if I put it in
the footer handler I wouldn''t be able to modify a control that lives in
the header. Any help would be appreciated.

Thanks,
Corey


这篇关于如何创建符合Section 508的数据网格 - ASP.NET v1.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆