Solved

Limiting the height of a drop down list?

Posted on 2008-09-29
6
322 Views
Last Modified: 2012-06-22
I have a drop down list with over 1000 items. How do I limit it so that it would only show 10 or 20 of the items? Intead of as many items as the screenspace will allow?
0
Comment
Question by:directxBOB
6 Comments
 
LVL 20

Expert Comment

by:informaniac
ID: 22595365
Set the ddl1.Items.Capacity

ddl1.Items.Capacity=10;
0
 

Author Comment

by:directxBOB
ID: 22595457
ddl1.Items.Capacity is the number of items that a DDL can store. What I am looking for is a way to limit the number shown, that the when you select the drop down it doesn't try to show all that the screenspace allows.
0
 
LVL 20

Assisted Solution

by:informaniac
informaniac earned 125 total points
ID: 22595485
Place a listbox instead and set the rows to 10...
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 22

Assisted Solution

by:prairiedog
prairiedog earned 125 total points
ID: 22597451
Change the Select query of the DDL's data source to limit the total:
SELECT Top 10 * FROM YourTable
0
 

Author Comment

by:directxBOB
ID: 22603804
I am not looking to limit the number of entries in the drop down list, just the scroll height.
0
 
LVL 2

Accepted Solution

by:
Kimpzor earned 250 total points
ID: 22604120
ASP.NET ddl does not have MaxDropDownItems property as win forms ddl do. I think you would have to build a custom  control with some javascript that loops out a drop down list. Also check a few tutorials about client script callbacks
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
What is MicroStrategy.NET? 2 47
Hidden Field Value 10 37
Entity Framework 3 14
Asp.net mvc foreach 3 15
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now