Solved

Limiting the height of a drop down list?

Posted on 2008-09-29
6
328 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Angular JS Route 3 68
convert html to string 6 34
Entity Framework 7 41
Webform example, External Authentication Services, OAUTH, asp.net 4.6.2 1 29
Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

813 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

13 Experts available now in Live!

Get 1:1 Help Now