Solved

css - textbox

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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

679 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