Solved

apply skinfile to drowdownlist

Posted on 2013-02-06
3
229 Views
Last Modified: 2013-02-14
I can apply skin to txtbox, but on dropdownlist it won't work. I am not sure why?


From Skinfile

asp:TextBox runat="server" SkinID="txtcity" ForeColor="Blue"></asp:TextBox>
<asp:DropDownList runat ="server" SkinID ="ddlstate" Forecolor ="Red"></asp:DropDownList>


aspx page

<asp:DropDownList ID="ddlstate" runat="server" Width="100px" TabIndex="9" Enabled="false" SkinID="ddlstate">
<asp:TextBox ID="txtCity" runat="server" Width="360px" TabIndex="8" MaxLength="30" ReadOnly="true" SkinID="txtcity"></asp:TextBox>
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
  • 2
3 Comments
 
LVL 26

Expert Comment

by:Alan Warren
ID: 38862068
This works ok, created a theme "Theme1" added a SkinFile "SkinFile1.skin"
Contents of Skinfile1.skin:
<asp:DropDownList runat="server" BackColor="Blue" ForeColor="Red" SkinId="dropdownlistBlue" />

Open in new window

Page sample:
<%@ Page Language="VB" title="MyGridview" EnableTheming="true" Theme="Theme1"%>

<!DOCTYPE html>

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:DropDownList SkinID="dropdownlistBlue" ID="DropDownList1" runat="server">
            <asp:ListItem></asp:ListItem>
            <asp:ListItem Value="1">Choice 1</asp:ListItem>
            <asp:ListItem Value="2">Choice 2</asp:ListItem>
        </asp:DropDownList>

    </div>
    </form>
</body>
</html>

Open in new window

Alan
0
 

Author Comment

by:VBdotnet2005
ID: 38862141
If the dropdownlist is set enable = "false", we can't change forecolor, correct? It will remains gray, no matter ?
0
 
LVL 26

Accepted Solution

by:
Alan Warren earned 500 total points
ID: 38862447
Hi VBdotnet2005,
couldn't find a way to change the forecolor for a disabled dropdownlist, backcolor, no problem.

The skinfile can have a CssClass, the CssClass can address styling for enabled and disabled.
Skinfile:
<asp:DropDownList runat="server" CssClass="styled-select" SkinId="dropdownlistBlue" />

Open in new window

Sample .aspx page styling dropdownlist, enabled and disabled:
<%@ Page Language="VB" title="MyDrowdownList" EnableTheming="true" Theme="Theme1"%>

<!DOCTYPE html>


<script runat="server">

    Protected Sub Button1_Click(sender As Object, e As EventArgs)
        Me.DropDownList1.Enabled = Not Me.DropDownList1.Enabled
    End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">

        .styled-select:enabled, .styled-select:disabled {
            background: transparent;
            color:black;
            background-color:yellow;
            width: 268px;
            padding: 5px;
            font-size: 16px;
            line-height: 1;
            border: 0;
            border-radius: 0;
            height: 34px;
            -webkit-appearance: none;
        }
        .styled-select:disabled {
            background-color:greenyellow;
            color:dimgray;
        }
 


    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:DropDownList CssClass="styled-select" ID="DropDownList1" runat="server" >
            <asp:ListItem></asp:ListItem>
            <asp:ListItem Value="1">Choice 1</asp:ListItem>
            <asp:ListItem Value="2">Choice 2</asp:ListItem>
        </asp:DropDownList>
        <br /><br />
        <asp:Button ID="Button1" runat="server" Text="Toggle dropdown enabled" OnClick="Button1_Click" />


    </div>
    </form>
</body>
</html>

Open in new window

Alan ";0)
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

726 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