472,142 Members | 1,065 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,142 software developers and data experts.

Setting BackColor of GridView cell dynamically

I have a number of colours in a database linked to different conditions,
and this data is displayed in a gridview. I want to set the BackColor
of a gridview cell dependent upon this value, for example FF0000 etc.
The code I have used gives me the error 'specified cast is not valid' :

<asp:TemplateField HeaderText="Forecast Type"
ID="lblForecastType" Text='<%# Eval("ForecastDescription") %>'
BackColor='<%# Eval("ForecastColor") %>' runat="server"></asp:Label>
<ItemStyle Height="24px"
Width="50px" />

Any ideas how to do this?

*** Sent via Developersdex http://www.developersdex.com ***
May 30 '06 #1
0 1693

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Rob Meade | last post: by
reply views Thread by Sourav Dutta Gupta | last post: by
4 posts views Thread by Ken Wigle | last post: by
8 posts views Thread by Jeff | last post: by
1 post views Thread by savajx1 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.