none
ASP.Net Styling DropDownList RRS feed

  • Question

  • Hi i found a bug when styling asp.net dropdownlists as shown below;  If i comment out the style and allow the style to come from the css file as i do with all my other controls the dropdownlist wont be styled i have to explicitly define the style in the aspx file.  Is there a work around for this?

    for reference im putting the identical .select class in the css file

    Thanks

    Madaxe

            <link rel="stylesheet" href="CSS/Custom/LekoSelect.css"/>
            <style type="text/css">  
            .select {  
                    border: 2px solid #8842d5;
                    border-radius: 5px;
                    height: 35px;
                    width: 100%;
                    background-color: DodgerBlue;
                    }  
            </style>  

                            <div class="UserType-Dropdown">
                                <asp:DropDownList  id="Dpd_PeopleType" type="text" name="t" placeholder="UserType" required="required" AutoPostBack="true" runat="server" CssClass="select">
                                    <asp:ListItem Text="Architect" Value="0" />
                                    <asp:ListItem Text="Client" Value="1" />
                                    <asp:ListItem Text="Developer" Value="2" />
                                    <asp:ListItem Text="Employee" Value="3" />
                                    <asp:ListItem Text="Engineer" Value="4" />          
                                </asp:DropDownList>
                            </div>

    Thursday, September 26, 2019 3:07 PM

All replies

  • Hi,

    On my side, the code segments work properly. There might be something wrong with the address issue of the CSS file.

    https://i.stack.imgur.com/faukt.gif

    Here is my project structure.

    https://i.stack.imgur.com/gIzVL.png

    One thing we should pay attention to is that we can’t use Asp.net directory, such as App_Data, App_Code directory.

    Feel free to let me know if the problem still exists.

    Best Regards

    Abraham

    Friday, September 27, 2019 2:10 AM
    Moderator
  • ASP.NET issues can be discussed at the ASP.NET forums.

    http://forums.asp.net/

    Friday, September 27, 2019 7:00 AM