Click here to Skip to main content
15,890,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi to all,
I need you're help in making a dropdown list that is small when closed but when opened the options are bigger.

Thanks..
Posted

1 solution

Write a JavaScript function which sets the width of the DropDownList to the required width and call this function onfocus of the DropDownList.

So something like:
XML
<asp:DropDownList ID="DropDownList1" runat="server" Width="60px" onfocus="javascript:changeWidth();">
</asp:DropDownList>


Javascript:
JavaScript
function changeWidth()
    {
        document.getElementById("DropDownList1").style.width = "150px";
    }
 
Share this answer
 
v2
Comments
Ganesan 2009 30-Aug-10 8:25am    
your script expand only DropDownbox but i need DropDownbox length fixed and based on that values list hav to expand DropDownlist.. Not a DropDownbox...
Ankur\m/ 30-Aug-10 8:41am    
I didn't get you. Can you please clarify?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900