Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

css - textbox

Posted on 2013-02-05
3
Medium Priority
?
518 Views
Last Modified: 2013-02-06
I don't know which section that change txtbox to gray when I set enabled = false.  How can I change font color in a specific  textbox to different color if textbox set to enabled = false?
Site.css
0
Comment
Question by:VBdotnet2005
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 38

Expert Comment

by:Tom Beck
ID: 38857783
You could try this. It should work in most modern browsers. For IE, probably only version 9 or above.

input.textEntry:disabled
{
    color:#eee
}

input.passwordEntry:disabled
{
    color:#eee
}
0
 
LVL 26

Expert Comment

by:Alan Warren
ID: 38858065
Didn't know you can address enabled and disabled properties of an input via CSS, Cool...

You could also switch CssClass or set the properties of the textbox programmatically, but CSS solution would be much cleaner.
 Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        If Me.TextBox1.Enabled = False Then
            Me.TextBox1.ForeColor = Drawing.Color.White
            'Me.TextBox1.CssClass = "disabled"
        Else
            Me.TextBox1.ForeColor = Drawing.Color.Black
            'Me.TextBox1.CssClass = "enabled"
        End If
 End Sub

Open in new window

Alan ";0)
0
 
LVL 3

Accepted Solution

by:
AshwaniMunshi earned 2000 total points
ID: 38858974
instead make it Readonly

<asp:TextBox ID="TextBox1" runat="server" Text = "XXXXX" ForeColor = "Red" ReadOnly = "true" ></asp:TextBox>

Then whatever color you've set in ForeColor property will apply. Or I think you can use CSS also if it is readonly and not disabled.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

670 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