Controlling the length of a Drop Down List...

SteveoAtilla

Regular
Joined
Dec 22, 2004
Messages
80
Location
The Frozen Tundra
Greetings all!

I have a large application that has rolled to production while development continues on further enhancements.

Anyway, as with any large corporate environment, systems differ somewhat from one machine to another, as well as resolution settings and display capabilities.

The behavior that I am seeing is that, on some systems, the users can see the entire drop down list (with or without scroll bar), and other users (and I have seen this on my own system) have a particularly long drop down list go right off the bottom of the screen.

My question is, can I control how many rows there are and when the scrollbar appears? I am changing the size of the text, which may be confusing the browser...

Any help would be GREATLY appreciated!

Kahuna
 
I assume you're doing a web application development. So the different behavior relates to different browser right? Could you tell us what are those browsers?

Btw are you talking about ListBox or DropDownList? I assume you're talking about ListBox because you mentioned scrollbars. For ListBox you can set the Rows property to do what you want.

CMIIW.
 
I believe you should approach this by going back to how the dropdownlist is populated. You can add a limit to this by populating the list through looping through the dataset instead of binding it as the datasource.

Another workaround which should require no development (since you mentioned this is a company-wide application) is to REQUIRE a certain resolution setting and browser/version.
 
Greetings!

Thanks for the replies, and sorry for the delay in getting back.

I am working in both IE 6.? and Mozilla. The behavior is the same in both browsers.

The controls are DropDown lists, which have scrollbars when the list reaches a certain length (what length? I don't know, that's one of the problems), and when I specify a larger font size (the page is displayed on a touch screen kiosk, so I need a larger font), the list goes off the bottom of the page, even though it there is a vertical scroll bar.

I build the dropdown lists by looping through a SELECT query and using the Items.Add method, not doing a bind.

I have checked all the properties of the dropdown list, and I have not found anything to limit the number of items to display. With a list box, I know I can specify rows, and have used this control in place of the dropdown list, but it is not a great choice, since it takes up more "real estate" on the page.

Any additional help is greatly appreciated!

Kahuna
 
I can see the problem now. However I can't find a decent clue to solving this problem.

Since you're using a dropdownlist, I don't think there's any property available to set the number of items to display.

I check it's counterpart HTML control. It is a fact that you cannot set the number of items to display on a dropdownlist. It is only possible with a listbox.

Maybe you should consider another method of showing the "real estate" items. Btw I don't get your reason for not using the listbox.

CMIIW.
 
Back
Top