JeepGeekin
asked on
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>
<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>
ASKER
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.
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.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
>> 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
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
ASKER
Thanks guys for all the posts. Jason's tip is what I was looking for.
no.
and if the width asignes to the ddl is minor that the length of the items it'll assume the item width