Set color of text in a Textbox/Label to Red and make it bold Set color of text in a Textbox/Label to Red and make it bold asp.net asp.net

Set color of text in a Textbox/Label to Red and make it bold


TextBox1.ForeColor = Color.Red;TextBox1.Font.Bold = True;

Or this can be done using a CssClass (recommended):

.highlight{  color:red;  font-weight:bold;}TextBox1.CssClass = "highlight";

Or the styles can be added inline:

TextBox1.Attributes["style"] = "color:red; font-weight:bold;";


Try using the property ForeColor.Like this :

TextBox1.ForeColor = Color.Red;


string minusvalue = TextBox1.Text.ToString();if (Convert.ToDouble(minusvalue) < 0){     // set color of text in TextBox1 to red color and bold.    TextBox1.ForeColor = Color.Red;}