BackColor on Label doesn't seem to work

T

tshad

Why doesn't BackColor on a label work (ForeColor works):

Dim theAnswer as Label
theAnswer.ForeColor = System.Drawing.Color.yellow
theAnswer.BackColor = System.Drawing.Color.green

BackColor on DataGridItem works fine.

Dim oGridItem as DataGridItem
oGridItem.BackColor = System.Drawing.Color.green

Thanks,

Tom
 
K

Ken Cox [Microsoft MVP]

It works here...

theAnswer.ForeColor = System.Drawing.Color.Yellow
theAnswer.BackColor = System.Drawing.Color.Green

renders as


<span id="theAnswer"
style="color:Yellow;background-color:Green;">Label</span>

Is there a stylesheet or something that is getting in the way?

Ken
 
T

tshad

Ken Cox said:
It works here...

theAnswer.ForeColor = System.Drawing.Color.Yellow
theAnswer.BackColor = System.Drawing.Color.Green

renders as


<span id="theAnswer"
style="color:Yellow;background-color:Green;">Label</span>

Is there a stylesheet or something that is getting in the way?

That is possible. There is a style sheet. I will need to spend some time
trying to get it to work by backing out parts of the stylesheet.

Thanks,

Tom
 
M

MWells

Tom, the style sheet shouldn't override the node's style. Before you spend
time dismembering your css, take a look at the generated HTML for your page
to see if your color setting is getting rendered.

If not, there's likely a bug in your code that some basic breakpoints and
tracing can locate quickly.

/// M
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top