Click here to Skip to main content
14,239,876 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi All,

While binding more than 600000 rows into the drop-down list then the page is hanged up.

What I have tried:

DataTable dt;
dt = GetDataTable(sqlQuery);
lb.DataSource = dt;
lb.DataTextField = Display;
lb.DataValueField = Value;
Updated 8-Jul-19 22:09pm
Rate this:
Please Sign up or sign in to vote.

Solution 1

Simple: Don't.

That is a very, very stupid thing to do, and would annoy the heck out of any user who had to use your app.
Think about it: it's easy for you to do (though it'd crash your site because it runs out of memory) but even if you get it working, imagine you are sat in front of the screen trying to use the drop down. How long is it going to take you - yes, you - to find the one row in those 60,000 items in the drop down (when it finally opens - because that is going to take some time all on it's own) that they are interested in? Seconds? Minutes? Hours? Days?

I'd take one look, and leave your site, never to return. And that's exactly what every other user is going to do. Life is too short to waste it on using a bad UI - there are probably loads of other sites out there offering the same data, I'll go to Google and find one.

Rethink your whole UI in terms of the "user experience" instead of "easy for me to code" - it'll improve both your abilities and the number of people willing to use your site.
DC2890 9-Jul-19 3:14am
Thanks for the response...
This is not my design and is a requirement of my client.
OriginalGriff 9-Jul-19 3:26am
Then your employer is an idiot - explain to him that it won't work, and would annoy the heck out of users if it did. Get him to try it on a windows demo app with 60,000 items in a drop down, and see how he feels about finding the value you inserted in a random location. Offer him a prize if he can do it in under ten seconds ...
F-ES Sitecore 9-Jul-19 3:57am
If you were a tailor and your client had a requirement for a cape that will make him fly like Superman, how would you handle it? Would you slog on to try and achieve the impossible, disappointing everyone, or would you manage his expectations, explain that what he wants isn't possible and look for alternatives?
OriginalGriff 9-Jul-19 4:55am
Woah! I misread that as 60,000 - but 600,000 items? That's beyond stupid - you are into new territory there ...
Dave Kreskowiak 9-Jul-19 12:38pm
Clients do NOT dictate "requirements" like this. 600,000 items will NEVER work in a control. It takes forever to populate it, if it works at all!, and will take a client a very long time to pick out any single item in the list.

This is where YOU tell the client that that "requirement" is not feasible, nor usable.

You MUST come up with a different method for presenting whatever information is required and doing with filtering to narrow down from 600,000 records to just what is needed.
Rate this:
Please Sign up or sign in to vote.

Solution 2

While binding more than 600000 rows into the drop-down list then the page is hanged up.

And your client expect to do precise moves in that list with scrolbar ?
Loading the phones numbers of a country is a bad idea.
Just think of it, if you can wait until the first number is typed, you can drop 90% of the list, with 2 numbers, it is 99% dropped.
Should be understandable by client that the full droplist is not a good idea, or that the full list have a price.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100