Drop Down List Item Width

Hey. I need to create a drop down box with a specific width, but the text of the list items expand past this width. Is there a way to set the list width & the List object width seperately? Also, I have some tough requirements, so I need to keep the width = 150 and I have to use a DDL. I just need to find a  way to expand the viewable text area of the drop down items. Thanks!

<asp:DropDownList ID="ddlQuestion" runat="server" Width="150px">
<asp:ListItem Text="" />
<asp:ListItem Text="What is your all-time favorite sports team?" />
<asp:ListItem Text="What is your father's middle name?" />
<asp:ListItem Text="What was your high school mascot?" />
<asp:ListItem Text="What is your spouse's middle name?" />
<asp:ListItem Text="What is your best friend's last name?" />
<asp:ListItem Text="What is your pet's name?" />
<asp:ListItem Text="What is your mother's maiden name?" />
</asp:DropDownList>
                                                           
JeepGeekinAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Elvio Lujan.Net Senior DeveloperCommented:
>>Is there a way to set the list width & the List object width seperately?
no.

and if the width asignes to the ddl is minor that the length of the items it'll assume the item width
0
JeepGeekinAuthor Commented:
Thansk Lem, but I am going to leave this open for other ideas.
I am willing to consider javascript or other client side solution for this. Seems like there be a solution for this. Even if it is a creative one. I'll bump up the points.
0
Jason ScolaroCommented:
Hi JeepGeekin,

I'm having a hard time finding an example of what I'm about to reference, but basically when this issue comes up, what you must do is create a TextBox, an Image (or <img), a Panel (or <div>), and a ListBox.  Like so:

This is generally used for a ComboBox look and feel, like here:  http://www.codeproject.com/aspnet/combobox.asp

Your implementation would change it so the TextBox is ReadOnly.

<asp:TextBox runat="server" id="TextBox1" Width="150px" /><img src="downarrow.gif" onclick="showPanel()" />
<div style="display:none;border:solid 1px #000">
    <asp:ListBox runat="server" id="ListBox1" Rows="5" Width="200px" />
</div>

Basically you're recreating the functionality of a DropDownList.  Hopefully that ComboBox article will be of some help.  Just trying to give you an idea of one way to solve this...
-- Jason
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

ArgblatCommented:
Here is a link with some info on your issue: http://icant.co.uk/forreview/tamingselect/

-Mike
0
RejojohnyCommented:
>> Is there a way to set the list width & the List object width seperately?
No, unless u create a custom control which beahaves like a dropdownlist .. its not going to be easy .. is it really worth the effort .. u culd always show tooltip of the selected item .. remember dropdownlist's tooltip does not work .. so wu ill have to write javascript function to show the selecteditem as a "div" tag .. just like a tooltip ..


Rejo
0
JeepGeekinAuthor Commented:
Thanks guys for all the posts. Jason's tip is what I was looking for.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.