gpt4 book ai didi

asp.net - ClientIDMode 是如何工作的?

转载 作者:行者123 更新时间:2023-12-04 06:03:29 27 4
gpt4 key购买 nike

我正准备进行 .NET 考试,我遇到了这个问题。我一直在为此烦恼,但我无法弄清楚:s我尝试了所有这些但没有想出一个明确的答案......

You are implementing an ASP.NET application that uses data-bound GridView controls in multiple pages. You add JavaScript code to periodically update specific types of data items in these GridView controls. You need to ensure that the JavaScript code can locate the HTML elements created for each row in these GridView controls, without needing to be changed if the controls are moved from one page to another. What should you do?

A. Replace the GridView control with a ListView control.

B. Set the ClientIDMode attribute to Predictable in the web.config file.

C. Set the ClientIDRowSuffix attribute of each unique GridView control to a different value.

D. Set the @ OutputCache directives VaryByControl attribute to the ID of the GridView control."


这就是我想出的:

A. Since the structure of the GridView and the ListView is similar andsince they generate the same sort of IDs, I scratched this one.

B. I tested this, but it doesn't seem to affect the IDs :s I think Iwould have to apply more settings than just this one to get someeffect.

C. This makes me wonder about what the question really says, thismakes all rows unique. But is that what is supposed to happen, sinceyou're not supposed to change code?

D. This is for caching, so has nothing to do with the question.


有人可以帮我解决这个问题吗?有任何想法吗?

最佳答案

该问题告诉您可以在多个页面中使用数据绑定(bind)的 GridView 控件,而且,如果将一个 gridview 控件从一个页面删除到另一个页面,那么它应该可以正常工作,而不会与已经存在的 gridview 控件发生任何冲突。

所以为此我们需要设置 GridView.ClientIDRowSuffix 属性。所以答案是C。

检查此MSDN关联。

关于asp.net - ClientIDMode 是如何工作的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8656911/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com