Last post Aug 31, 2008 11:25 PM by Peter Bucher
May 05, 2008 04:26 PM|softpathus|LINK
i need some help in writing a custom dropdownlist with fixed width.
I have lot of dropdown's on my form and they occupy lot of space (the lenght of the options are long).
<option> NEW YORK NORTHERN COMMUTER </option>
any help would be highly appreciated.
"fixed width dropdownlist"
May 05, 2008 05:37 PM|smiling4ever|LINK
Welcome to the ASP.NET forums
Just add the width attribute to your ddl tag
<asp:dropdownlist width="200px" . ...
May 05, 2008 05:39 PM|johram|LINK
The DropDownList control exposes a Width property which you can set both in markup or in code-behind:
<asp:DropDownList ID="DropDownList1" runat="server" Width="300px"></asp:DropDownList>
Or you could use CSS to set it from code behind:
May 05, 2008 11:16 PM|softpathus|LINK
i wanted to develop a control that would have a fixed length, but the list items should be able to show the whole description.
Aug 31, 2008 10:39 PM|terbs|LINK
I have the same problem.
I.e If I do not set a width to the DDL the longest item determines the width. I need to set a shorter width, but still retain the dynamic width when the list is expanded.
Firefox seems to handle this by itself. IE is stubborn and just displays its list width the same as the control width.
Has anyone found a solution to this problem?
Aug 31, 2008 11:25 PM|Peter Bucher|LINK
As you see, theres no native solution there.