如何为中继器内的每个 GridView 标题指定不同的颜色?
我有一个 Repeater
和 Repeater
内的三个 GridView
。每个 GridView
都有与其他不同的列,因为我有一个存储过程,并且每个 GridView
根据存储过程中的 HiddenField
的值有不同的列中继器。
现在,我想为每个 GridView 指定不同的颜色,特别是对于每个 GridView 中不同的列。
我该怎么做?
I have a Repeater
and three GridView
s inside the Repeater
. Each GridView
has different columns than the others since I have a stored procedure and each GridView
has different columns based on the value of a HiddenField
inside the repeater.
Now, I would like to give each GridView
a different color, especially for the columns that are different in each GridView
.
How would I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,您可以在转发器上使用 OnItemCreated 事件,然后通过 Controls 集合获取 GV 和 HiddenField 并用它们做任何您想做的事情。
但是,我不会使用中继器来输出不相似的内容。如果网格视图差异如此之大,那么中继器的意义何在?为什么不只制作三个单独的网格视图呢?
Well, you could use the OnItemCreated event on the repeater and then grab the GV and the HiddenField through the Controls collection and do whatever you want with them.
However, I wouldn't use a repeater for outputting stuff that isn't alike. If the gridviews are that much different, what is the point of the repeater? Why not just make three seperate gridviews?