We help IT Professionals succeed at work.

ASP.net DropDown squashing together

Murray Brown
Murray Brown asked
on
Hi

In my ASP.net web app I am having a problem with the items in a DropDown squashing together as shown in the image
Image1.jpg
Comment
Watch Question

Obadiah ChristopherDeveloper User Interface
CERTIFIED EXPERT

Commented:
What css is applied to the dropdownlist?
Murray BrownASP.net/VBA/VSTO Developer

Author

Commented:
Hi

I am not sure how to show you that. I can view the CSS properties. Where do I get that?
Obadiah ChristopherDeveloper User Interface
CERTIFIED EXPERT

Commented:
IE Developer toolbar of Firebug in FF..
Commented:
In your CSS file for your project, you can create an element that controls font attributes, along with padding and margin.  Then just set the DDL control CssClass property to the element.

For example, put this element in your CSS file (you can change the properties as needed):
.DDLStyle
{
	color: #000000;
	font-family: Verdana, Arial;
	font-size: medium;
	font-weight: normal;
	padding: 2px;
	margin: 0px;
}

Open in new window

Then in your aspx, just referrence the CSS element on the Drop Down Control like this:
<asp:DropDownList ID="DDL_Answer" runat="server" CssClass="DDLStyle">
	<asp:ListItem Value="" Text="Select ..." />
	<asp:ListItem Value="N" Text="No" />
	<asp:ListItem Value="Y" Text="Yes" />
</asp:DropDownList>

Open in new window

Murray BrownASP.net/VBA/VSTO Developer

Author

Commented:
thanks very much

Explore More ContentExplore courses, solutions, and other research materials related to this topic.