473,545 Members | 721 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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:TemplateFi eld HeaderText="For ecast Type"
SortExpression= "ForecastDescri ption">
<ItemTemplate >
<asp:Label
ID="lblForecast Type" Text='<%# Eval("ForecastD escription") %>'
BackColor='<%# Eval("ForecastC olor") %>' runat="server"> </asp:Label>
</ItemTemplate>
<ItemStyle Height="24px"
Width="50px" />
</asp:TemplateFie ld>

Any ideas how to do this?

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

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

Similar topics

3
2165
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 'named' colour - but how do I set this for #d4c5db as an example? I have
0
1110
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 to get the Xml values in a DataTable and bind them in the HTML to the ImageButtons as BackColor = '<%#...
1
2535
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 image) on each rowdatabound event and then display it on a mouse over on the gridview cell. Is it possible?
4
8316
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 date column always shows the date and time while I just want the short date. I have tried applying a format string {0:d} but to no avail. I saw a...
8
9136
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 file... Anyone got any tips about how to do this? Jeff
1
15028
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 to add controls dynamically as I am trying to write a reusable , general , spreadsheet like display control that can take advantage of the built- in...
5
2974
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 New TableCell cell1.Text = "Java" row1.Cells.Add(cell1)
3
2045
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) which contains the value "0". How to do this,thanxs in advance for Any kind of suggestion .......
1
3325
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) to blink between two colors, say for example the cell background color must blink (two colors using yellow, green). Is this possible ? I am able to...
0
7656
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7752
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5969
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5325
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4944
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1878
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1013
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
701
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.