Solved

apply skinfile to drowdownlist

Posted on 2013-02-06
3
228 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
  • 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
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…

860 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