Solved

apply skinfile to drowdownlist

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

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