使用列值设置背景颜色? [英] Set Background Color Using Column Value?
问题描述
非常新手的问题,我希望这是正确的群体。我在网页上有一个
表,其中包含有关油漆颜色的信息。一栏
包含颜色'RGB值的十六进制值。我想从网格或表格中的表格中显示
信息,并使用RGBHex列中的列值来设置每一行的背景颜色。我可以使用< %%标签在旧式ASP中进行此操作,但我会在.NET 2中实现它。我的网站有这在
旧ASP中实现: www.paintmatcher .com / tool / tool.asp 任何帮助都非常值得赞赏。
Very newbie question and I hope this is the right group. I have a
table on a web page which contains info about paint colors. One column
contains the hex value for the color''s RGB value. I want to display
info from the table in a grid or table and use the column value from
the RGBHex column to set each row''s back ground color. I can just
about do this in my sleep in old style ASP using <%%tags but I would
like to implement it in .NET 2. My website has this implemented in
old ASP here: www.paintmatcher.com/tool/tool.asp Any help is greatly
appreciated.
推荐答案
3月17日下午1:26,TF < TJForw ... @ gmail.comwrote:
On Mar 17, 1:26 pm, "TF" <TJForw...@gmail.comwrote:
RGBHex列设置每一行的背景颜色。我可以在我的睡眠中使用< %%标签
the RGBHex column to set each row''s back ground color. I can just
about do this in my sleep in old style ASP using <%%tags
我可以在睡觉时使用
ASP 3:
bgcolor ="#<%= hex_value%>"
其中" hex_value"是一个变量
it could be the same as in ASP 3:
bgcolor="#<%=hex_value%>"
where "hex_value" is a variable
这里是MS Vis Web Developer 05创建的代码片段
Express。表格中的数据显示得很好。我想根据RGBHex的值设置每行的背景颜色
。字段。
< asp:GridView ID =" GridView1" RUNAT = QUOT;服务器" AllowSorting =" True"
AutoGenerateColumns =" False"
DataKeyNames =" ID"的DataSourceID = QUOT; AccessDataSource2"
EmptyDataText = QUOT;有没有数据记录到
显示"。>
将柱体和GT;
< asp:BoundField DataField =" ID" HeaderText =" ID"
ReadOnly =" True"的SortExpression = QUOT; ID" />
< asp:BoundField DataField =" Brand" HeaderText =" Brand"
SortExpression =" Brand" />
< asp:BoundField DataField =" Colorname"
HeaderText =" Colorname"的SortExpression = QUOT; Colorname" />
< asp:BoundField DataField =" RGBValue" HeaderText =" RGBValue"
SortExpression =" RGBValue" />
< asp:BoundField DataField =" RGBHex" HeaderText =" RGBHex"
SortExpression =" RGBHex" />
< / Columns>
< / asp:GridView>
我可以使用ASP 3< BoundField标签内的%%标签?我如何使用ASP.NET分配给变量来调用字段值?
或者
也许有比使用GridView更好的解决方案。还有其他什么吗?
谢谢。
Alexey Smirnov写道:
Here''s a snippet of the code created by MS Vis Web Developer 05
Express. The data from the table displays just fine. I want to set
the back color of each row based on the value of the "RGBHex" field.
<asp:GridView ID="GridView1" runat="server" AllowSorting="True"
AutoGenerateColumns="False"
DataKeyNames="ID" DataSourceID="AccessDataSource2"
EmptyDataText="There are no data records to
display.">
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID"
ReadOnly="True" SortExpression="ID" />
<asp:BoundField DataField="Brand" HeaderText="Brand"
SortExpression="Brand" />
<asp:BoundField DataField="Colorname"
HeaderText="Colorname" SortExpression="Colorname" />
<asp:BoundField DataField="RGBValue" HeaderText="RGBValue"
SortExpression="RGBValue" />
<asp:BoundField DataField="RGBHex" HeaderText="RGBHex"
SortExpression="RGBHex" />
</Columns>
</asp:GridView>
Could I use ASP 3 <%%tags inside the BoundField tag? How would I
call the field value using ASP.NET to assign to the variable? Or
maybe there''s a better solution than using a GridView. Any other
ideas?
Thanks.
Alexey Smirnov wrote:
3月17日下午1:26,TF < TJForw ... @ gmail.comwrote:
On Mar 17, 1:26 pm, "TF" <TJForw...@gmail.comwrote:
RGBHex列设置每一行的背景颜色。我可以只使用< %%标签
the RGBHex column to set each row''s back ground color. I can just
about do this in my sleep in old style ASP using <%%tags
在我睡觉时使用< %%标签来做这件事。它可能与ASP 3:
bgcolor ="#<%= hex_value%>"
其中" hex_value"是一个变量
it could be the same as in ASP 3:
bgcolor="#<%=hex_value%>"
where "hex_value" is a variable
更多请看这里!
http://www.flash50.com/index.php
>
这篇关于使用列值设置背景颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!