• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 350
  • Last Modified:

Limiting the height of a drop down list?

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
directxBOB
Asked:
directxBOB
3 Solutions
 
Obadiah ChristopherCommented:
Set the ddl1.Items.Capacity

ddl1.Items.Capacity=10;
0
 
directxBOBAuthor Commented:
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
 
Obadiah ChristopherCommented:
Place a listbox instead and set the rows to 10...
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
prairiedogCommented:
Change the Select query of the DDL's data source to limit the total:
SELECT Top 10 * FROM YourTable
0
 
directxBOBAuthor Commented:
I am not looking to limit the number of entries in the drop down list, just the scroll height.
0
 
KimpzorCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now