473,396 Members | 1,784 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 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"
SortExpression="ForecastDescription">
<ItemTemplate>
<asp:Label
ID="lblForecastType" Text='<%# Eval("ForecastDescription") %>'
BackColor='<%# Eval("ForecastColor") %>' runat="server"></asp:Label>
</ItemTemplate>
<ItemStyle Height="24px"
Width="50px" />
</asp:TemplateField>

Any ideas how to do this?

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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Rob Meade | last post by:
Hi all, I need to set some table cells which I am adding from code. I am using; cell.backcolor = cell.backcolor.white for example to set it to white - this is all very well and good for a...
0
by: Sourav Dutta Gupta | last post by:
How can I set the BackColor of an ImageButton dynamically. Actually, I am getting colors as a string like "#FF00FF". I want them to set as BackColor to the imagebuttons at runtime. I have tried...
1
by: NH | last post by:
ANy ideas on how to acheive this? I want to display a dynamically created image when a mouse over occurs on a gridview event. I need some way of creating the image (it will be a small chart type...
4
by: Ken Wigle | last post by:
All, I would be very grateful for any help on this question. I have an application in asp.net 2.0 where I dynamically create a datatable and then bind that to a gridview. Unfortunately, the...
8
by: Jeff | last post by:
ASP.NET 2.0 I have a webpage which contains a GridView. I want this GridView's HeaderTemplate to display the text "Inbox" or "Outbox"... So I think I need to set the value in the code behind...
1
by: savajx1 | last post by:
I need to dynamically create a set of bound fields contained in a GridView control. I also have a single static CommandField that I can declare in the Columns <tagof the GridView control. I have...
5
by: davidson1 | last post by:
Hai Friends, I have the following code for Dynamically Created Tables, I have created the panel in the webform....... Dim tab5 As New Table Dim row1 As New TableRow Dim cell1 As...
3
by: giveDsolution | last post by:
Hello Frds, I have bind a gridview with the help of a Datatable as the columns are added dynamically. But my problem is i have to add a gridview in any cell (which will be bind by another Query)...
1
by: nirmala26 | last post by:
Hi All, I am using C#.net to develop a web application. I have a gridview and a table displaying two different lists of data. I want to have the backcolor of the cell (of both gridview and table)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.