?
Solved

How to set a new color...

Posted on 2005-03-31
12
Medium Priority
?
309 Views
Last Modified: 2008-02-01
I want to set a new color. i.e "Red" to a Dropdown List when it's in disabled mode. By default it's disabled color is gray, so, how can I change it to Red?
0
Comment
Question by:NeGueSa
[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
  • 4
  • 4
  • 2
  • +2
12 Comments
 
LVL 51

Expert Comment

by:Steve Bink
ID: 13676090
Use a style entry.  Are you familiar with <STYLE> tags?
0
 

Author Comment

by:NeGueSa
ID: 13676106
No I'm not, but can you show me how to do it? I mean to change the color of the dropdown list.
0
 
LVL 12

Expert Comment

by:kingsfan76
ID: 13676237
<select name=Sel1 style="BACKGROUND-COLOR:RED" disabled>

if you need to change the color dynamically using javascript, you can set it like this:

document.myForm.Sel1.style.BACKGROUND-COLOR = "RED";
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:NeGueSa
ID: 13676359
I'm sorry, but as I tell you I'm not familiar with java, so, The color I want to change is the forecolor of the dropdown list which is disabled, and let's say that my dropdown list is called "CustomList"
The code will be like this?
document.CustomList.Style.Color = "Red"
But this wil be for normal color, what about the disabled color?
0
 
LVL 12

Expert Comment

by:kingsfan76
ID: 13676515
how does it determine if the select box is disabled or not?  is it throught some asp code?  if it's in asp code then it would be something like this:

<select name=CustomList <%if disabledYN="Y" then response.write("disabled style='BACKGROUND-COLOR:RED'")%>>


0
 
LVL 14

Expert Comment

by:kiddanger
ID: 13677810
Just so you know...scripting CSS is different:

document.myForm.Sel1.style.BACKGROUND-COLOR = "RED";

Is not correct.

document.myForm.Sel1.style.backgroundColor='red';
or
document.myForm.Sel1.style.backgroundColor='#f00';

The rule is the - is removed and the following character is capitalized.

font-weight | fontWeight
background-color | backgroundColor
text-align | textAlign
border-width | borderWidth

For the OP: http://www.w3schools.com/css/default.asp

BTW... java != javascript
0
 

Author Comment

by:NeGueSa
ID: 13681109
I was trying to test these statements you gave me and nothing, it's giving me errors.
Please, could you be more specific?
This Dropdown List "CustomList" is disabled by default  and I puting it enabled/disabled in my vb code.
Do I have to put your [line of code] in the vb code or in the html page of the Web Form?
0
 
LVL 12

Expert Comment

by:kingsfan76
ID: 13683491
can you show the vb code where you enable/disable CustomList?
0
 

Author Comment

by:NeGueSa
ID: 13683571
Yes of course here's the code :

    Private Sub ContDataGrid_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ContDataGrid.SelectedIndexChanged
        Dim SelRow As Integer = Me.ContDataGrid.SelectedIndex
        Dim contseq As Integer = CInt(Val(ContDataGrid.Items(SelRow).Cells(5).Text))

        Dim cm As New SqlCommand() 'Declaring Connection
        Dim flg As String 'Declaring Result

        cm.CommandText = "SELECT Name, Acc , Email, Method, Sheet FROM  Contact WHERE Seq ='" & contseq & "'" 'Making the Query
        cm.Connection = SqlCon 'stablishing connection
        SqlCon.Open() 'opening connection

        Dim dr As SqlDataReader = cm.ExecuteReader 'reading
        While dr.Read
            If IsDBNull(dr.Item(0)) = False Then
                flg = dr.Item(0) 'assigning value
                If IsDBNull(dr.Item(1)) = False Then
                    CustomList.SelectedIndex() = Me.Cboctype.Items.IndexOf(Me.Cboctype.Items.FindByValue(Trim(dr.Item(1))))
                    Me.lblctype.Visible = True
                    Me.CustomList.Visible = True
                Else
                    Me.lblctype.Visible = False
                    Me.CustomList.Visible = False
                End If
            Else
                'no users
                'Put here N/A for all values
                Exit While 'exiting
            End If
        End While
        dr.Close() 'closing reading
        dr = Nothing 'assigning value 0
        SqlCon.Close() 'closing connection
    End Sub
0
 
LVL 12

Accepted Solution

by:
kingsfan76 earned 250 total points
ID: 13684352
i see... you should have stated it is asp.net coz by default we all assume it is classic asp.  I'm less familiar with .net, but you might try this and see if it works:

Me.CustomList.Style("BACKGROUND-COLOR") = "RED"

here's a link to some samples on how to apply style in .net
http://www.dotnetjunkies.com/quickstart/aspplus/doc/webtemplates.aspx

sorry i don't have a .net compiler right now at work so i can't be sure if the solution works.  
0
 
LVL 22

Expert Comment

by:WMIF
ID: 14876576
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.  I will make a recommendation to the moderators on its resolution in a week or two.  I appreciate any comments that would help me to make a recommendation.

Unless it is clear to me that the question has been answered I will recommend delete without refund of points.  It is possible that a Grade less than A will be given if no expert makes a case for an A grade.  It is assumed that any participant not responding to this request is no longer interested in its final disposition.

If the user does not know how to close the question, the options are here:
http://www.experts-exchange.com/help.jsp#hs5

WMIF
EE Cleanup Volunteer
0
 
LVL 22

Expert Comment

by:WMIF
ID: 14931044
I am leaving the following recommendation for this question in the Cleanup topic area:
Delete - No refund

Any objections should be posted here in the next 4 days.  After that time, the question will be closed.

WMIF
EE Cleanup Volunteer
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
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…
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…
Suggested Courses

762 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