Solved

css - textbox

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now