ASP.Net Styling DropDownList RRS feed

  • Question

  • Hi i found a bug when styling 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



            <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;

                            <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" />          

    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.

    Here is my project structure.

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

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

    Best Regards


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

    Friday, September 27, 2019 7:00 AM