Loading a large DropDownList

A

Amit

I have a very poorly written ASP.NET application that I need to maintain
(why me?!!). One of the pages has a huge drop-down list that loads more than
a 1000 items. Because of this the resulting page is huge - nearly 1.5MB. To
reduce the size I turned off the viewstate on the drop-down list and that
brought the size down to 125kb which is not great but much better than
1.5MB. Now the problem is how do I find out what the selected item is, if I
don't maintain its viewstate? I don't want to remove the drop-down list,
ugly as it may be. Any ideas?
Thanks
Amit
 
B

Bob Barrows [MVP]

Amit said:
I have a very poorly written ASP.NET application that I need to
maintain (why me?!!). One of the pages has a huge drop-down list that
loads more than a 1000 items. Because of this the resulting page is
huge - nearly 1.5MB. To reduce the size I turned off the viewstate on
the drop-down list and that brought the size down to 125kb which is
not great but much better than
1.5MB. Now the problem is how do I find out what the selected item
is, if I don't maintain its viewstate? I don't want to remove the
drop-down list, ugly as it may be. Any ideas?

Does it have to be a dropdown?
If so, provide the user with a way to limit the number of items in the
dropdown list. Perhaps a textbox into which the user types a few letters
which are then used to only retrieve the corresponding items to be displayed
in the list.

Bob Barrows
 
R

Ryan Trudelle-Schwarz

Amit said:
Does it have to be a dropdown?
If so, provide the user with a way to limit the number of items in the
dropdown list. Perhaps a textbox into which the user types a few
letters
which are then used to only retrieve the corresponding items to be
displayed
in the list.

Bob Barrows

Does the old trick of rebinding the control during the init event work for
drop down lists?
 
B

bruce barker

just manually set it in oninit. the selectedvalue will be in the forms
collection posted by the browser (Request.Form['controlname']), if the
control is not in the collection, then there is no selection.

-- bruce (sqlwork.com)

| I have a very poorly written ASP.NET application that I need to maintain
| (why me?!!). One of the pages has a huge drop-down list that loads more
than
| a 1000 items. Because of this the resulting page is huge - nearly 1.5MB.
To
| reduce the size I turned off the viewstate on the drop-down list and that
| brought the size down to 125kb which is not great but much better than
| 1.5MB. Now the problem is how do I find out what the selected item is, if
I
| don't maintain its viewstate? I don't want to remove the drop-down list,
| ugly as it may be. Any ideas?
| Thanks
| Amit
|
|
 
A

Amit

Does it have to be a dropdown?
If so, provide the user with a way to limit the number of items in the
dropdown list. Perhaps a textbox into which the user types a few letters
which are then used to only retrieve the corresponding items to be displayed
in the list.

Bob Barrows
--

I'm trying to convince the customer that this would be a good idea. His
point is that sometimes users will see an item in the list that they
recognize and which they would not otherwise know was inlcuded. He wanted an
auto-complete textbox (like Google suggest) but I'm not quite sure how to go
about it.
 
A

Amit

bruce barker said:
just manually set it in oninit. the selectedvalue will be in the forms
collection posted by the browser (Request.Form['controlname']), if the
control is not in the collection, then there is no selection.

-- bruce (sqlwork.com)

Thanks, I will try this out.
 
A

Amit

bruce barker said:
just manually set it in oninit. the selectedvalue will be in the forms
collection posted by the browser (Request.Form['controlname']), if the
control is not in the collection, then there is no selection.

-- bruce (sqlwork.com)
Works like a charm! Thanks for the useful tip
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top