Zerotoinfinity
Zerotoinfinity

Reputation: 6540

Blinking and coloring asp.net label control

I have a asp.net label control on my webform:

for this label I am setting the text property from code behind:

lblOne.Text = "Number of student is: 86 and Number of teacher is: 7";

Now I want to do 2 things:

  1. Blinking the label.
  2. Coloring: "Number of student is:" - RED Color "86" :- BLUE

             "and Number of teacher is:" - RED & 7:- BLUE
    

How can I do these things?

Upvotes: 0

Views: 4163

Answers (1)

Hans Kesting
Hans Kesting

Reputation: 39338

Are you really sure you want that text to blink, the <blink> tag disappeared for a reason :-)

You could set a ForeColor for a label, but only for the complete Label. So what you could do is split that text into two labels, one blue and one red.

A different solution would be to use a Literal and set the html yourself:

Literal1.Text = String.Format("Number of student is: <span style='color:red'>{0}</style> and Number of teacher is: <span style='color:blue'>{1}</span>", student, teacher);

Upvotes: 1

Related Questions