Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select all in a drop down combo box

Status
Not open for further replies.

Sniipe

Programmer
Oct 9, 2006
115
IE
I have a combo box, that unfortunately has 8000 + items in it. Retarded, I know, but what can I do.

Anyway there is a check box that selects all. But when I select it and go thru the for loop that selects every value it takes a good few seconds.

Is there a quicker way to select all?

A second question related to the same dropdown; I added in an extra feature that disabled the dropdown when I selected all. But for some reason in the code behind (C#) it doesn't recognise the values as being selected, this is probably due to the disabling...

So I want to disable the drop down but have the values selected. Any ideas? I think I saw someone on some site yesterday mention that I can do a different kind of disabling, but I'd also have to gray out the text so it appears to be disabled...
 
Hi

If the [tt]select[/tt] [tt]option[/tt]s are static, then do not actually select them. Just check that [tt]checkbox[/tt] value on server side and if turned on, then load the 8000+ items from where you have them ( database, data file, whatever ) and treat them as they would be all selected.

The above suggestion resolves the second question too. Otherwise you can just set the [tt]select[/tt] [tt]readonly[/tt] insterad of [tt]disabled[/tt].

Anyway, we can not suggest much on code optimization if you not post the code...

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top