Solved

apply skinfile to drowdownlist

Posted on 2013-02-06
3
223 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
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.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

744 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

17 Experts available now in Live!

Get 1:1 Help Now