Hi,
Using ASP.Net and Visual Studio 2005, I am attempting to dynamically change the backgournd colour of a label.
In the smart tag for the Label, I have selected 'Edit Databindings'
Then I have selected the Backcolor property, and assigned to a column (WebColour) from my table.
It has added this code to my label tags:
Backcolor='<%# Eval("WebColour) %>'
I've tried three different data formats in my table:
#000000
000000
0
All of them result in a 'specified cast is not valid' error at the backcolor tag.
When I type
? Eval("WebColour)
in the command window I see the exact data that I am expecting.
Can anyone tell me what format this needs to be in in that database?
Also can you tell me what the # symbol is doing in the statement... I understand the rest.
The label is inside a FormView control which is working fine in every other way.
ASKER