Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Limiting the height of a drop down list?

Posted on 2008-09-29
6
Medium Priority
?
342 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 500 total points
ID: 22595485
Place a listbox instead and set the rows to 10...
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 22

Assisted Solution

by:prairiedog
prairiedog earned 500 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 1000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Loops Section Overview
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

972 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