Auto Resize Dropdown Box

Auto Resize Dropdown

Sometimes, using a built-in dropdown control does not meet your requirement. Suppose a dropdown box contains text that is longer in length than your box; therefore, the width of the dropdown will increase as the text length increases. But, an increase in the dropdown's size affects your form design. You don't have enough space on your page to fit this lengthy dropdown box. In that case, you can use this Auto Resize Dropdown box.

Create a blank solution; in the solution, add a class library; and in the class file, add the following code. This code shows that, at the time of rendering the control, with the help of a style you can maintain the initial width of your dropdown box.

About the Author

Ashish Singh

I am working as I.T. Analyst at Tata Consultancy Services Ltd. I have 4+ years of experience in Microsoft Technologies. I have worked primarily as a Dot Net Developer with C# and VB.Net as code behind.

Top White Papers and Webcasts

When individual departments procure cloud service for their own use, they usually don't consider the hazardous organization-wide implications. Read this paper to learn best practices for setting up an internal, IT-based cloud brokerage function that service the entire organization. Find out how this approach enables you to retain top-down visibility and control of network security and manage the impact of cloud traffic on your WAN.

U.S. companies are desperately trying to recruit and hire skilled software engineers and developers, but there is simply not enough quality talent to go around. Tiempo Development is a nearshore software development company. Our headquarters are in AZ, but we are a pioneer and leader in outsourcing to Mexico, based on our three software development centers there. We have a proven process and we are experts at providing our customers with powerful solutions. We transform ideas into reality.