Link to home
Start Free TrialLog in
Avatar of chaleastale
chaleastale

asked on

I want to change the forecolor of an html text box at the code behind where its runat ="server" property set to true.

I want to change the forecolor of an html text box at the code behind where its runat ="server" property set to true.
How to do that?

any help is appreciated.

tx
ASKER CERTIFIED SOLUTION
Avatar of vipero
vipero

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pashik
pashik

Hi.
here is example in VB.Net to do it in code-behind: myTextBox.Style.Add("background-color", "red")
in C# it is the same.
Avatar of chaleastale

ASKER

I couldn't find Style.Add on c# it is Attributes.Add. What about to change the forecolor?
Here is code in C#:
TextBox1.Style.Add("color","red"); - text in textbox (forecolor) will have such color
TextBox1.Style.Add("background-color","green");  - background of textbox will have such color
don't forget to put it into cs:
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;