Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2006-04-10
5
Medium Priority
?
948 Views
Last Modified: 2008-01-09
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
0
Comment
Question by:chaleastale
  • 3
5 Comments
 
LVL 5

Accepted Solution

by:
vipero earned 375 total points
ID: 16416656
I don't use such kind of technologies, but you could try to set its style this way: style="color:#ff0000; background-color:#000040"  (quotes included) and so on.

0
 
LVL 2

Expert Comment

by:pashik
ID: 16417775
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.
0
 

Author Comment

by:chaleastale
ID: 16427270
I couldn't find Style.Add on c# it is Attributes.Add. What about to change the forecolor?
0
 
LVL 2

Expert Comment

by:pashik
ID: 16434177
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
0
 
LVL 2

Expert Comment

by:pashik
ID: 16434184
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;
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses
Course of the Month11 days, 22 hours left to enroll

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question