Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In the following code I want to dynamically display the color of the variable 'v_totalitemsfound'
in red. I attempted with span but not accepting.

totalitemsfound.Text = "(in this category " + Convert.ToString(v_totalitemsfound) + " items found)";
Posted
Comments
S.Rajendran from Coimbatore 7-Jul-14 3:28am    
This is for web form in asp.net

1 solution

See I have tested a code following below
protected void Page_Load(object sender, EventArgs e)
   {
       Label1.Text = "<span style='color:red'>This is testing only</span>";

   }

And for you that should be
totalitemsfound.Text = "<span style='color:red'>(in this category " + Convert.ToString(v_totalitemsfound) + " items found)</span>";
 
Share this answer
 
v2
Comments
S.Rajendran from Coimbatore 7-Jul-14 5:56am    
I dont want the color of the whole thing to be in red. I want only the text inside that variable 'v_totalitemsfound' to be in red.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900