Solved

css - textbox

Posted on 2013-02-05
3
516 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 500 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

632 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