Solved

Populating Combo Box

Posted on 2003-11-27
23
449 Views
Last Modified: 2010-04-09
Hello...

I have an asp page with a combo box...I want to populate the combo box with the value of a field from a sql table . But the table has 2 lakh records..and when I try to populate the combo box ..the records are not populating the combo box..but it populating when i m using a few thousand records...

Pls let me know how i can populate the combo box with more than 2 lakh records...
0
Comment
Question by:pranabdhar
  • 9
  • 4
  • 3
  • +5
23 Comments
 
LVL 31

Expert Comment

by:seanpowell
ID: 9830740
Sorry - what is "2 lakh records"
0
 
LVL 5

Expert Comment

by:apparition
ID: 9832340
I think he means 200 thousand records.
0
 
LVL 5

Expert Comment

by:apparition
ID: 9832368
You should re-think the way you are trying to do this, loading 200 thousand records in a combobox is bad UI practice
and apart from it not working properly it can also be very annoying for the user. If you explain in detail what it is you are
actually trying to do maybe we can come think of an alternative.
0
 
LVL 31

Expert Comment

by:seanpowell
ID: 9832407
>>200 thousand records.
Are you serious?
0
 
LVL 5

Expert Comment

by:apparition
ID: 9832464
yap 1 lakh = 100 thousand

lakh is an indian word meaning 100 thousand
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 9832494
listening....

This looks like fun.  and let's get load time in 3 seconds.  ;^)

Cd&
0
 
LVL 31

Expert Comment

by:seanpowell
ID: 9832517
That's almost the complete Oxford English Dictionary - do you need any special styling on that or is plain text sufficient?

Also, are you using a ComboBox or a Select Box - these are two different things.

Maybe you could post the records here and we'll have a look :-)
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 9834374
just out of curiosity, mainly to check the size limit on a select(thought it would bum out at 32767 items) i ran the following in coldfusion

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
      <title>Untitled</title>
</head>

<body>
<cfquery name="junkSQL" datasource="xxx" password="xxx" username="xxx">
SELECT ltrim(rtrim(EmpId)) as Empid, CourseId
FROM VTRAING      
</cfquery>
<cfoutput>
#junkSQL.recordCount#<br>
<select name="pureJunk">
<cfloop query="junkSQL">
<option value="#empid#">#empid#</option></cfloop>
</select>
</cfoutput>
<br>
<input type="button" onClick="alert(pureJunk.options.length)">
</body>
</html>

with the following results

table contains 106910 records
compile time a little over 2 minutes (surprised it didn't time out) and this was the only thing on the page!
number of records in the selectbox 106910 (again, surprised it could hold that many items)

pranabdhar, good luck you'll need it to get this to work in anything approaching a reasonable time and why in the world would you need a 200 k selectbox?
0
 
LVL 11

Expert Comment

by:Zontar
ID: 9836970
I did the same thing in PHP with a simple loop, no DB, just a straight counter:

<select>
<?php
  for($i = 1; $i <= 200000; $i++)
    echo "<option value=\"$i\">$i</option>\n";
?>
</select>

Elapsed time: 25.337 seconds. This was *all* that was in the page, and it was run from the server sitting next to my desktop via a 100Mb LAN. MSIE chewed up 94 MB of memory and pegged my CPU at 100% the whole time while rendering it.

People will not be thanking you for throwing something like this at them.

WTF would you need 200,000 choices in a single select for, anyway???
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 9842488
I want to see the user willing to scroll through the select to find the option they want.

Cd&
0
 
LVL 31

Expert Comment

by:seanpowell
ID: 9842500
Hey, I finally found it! That was worth the 1 1/2 hours.

Drat - hit the reload key by mistake.
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 33

Expert Comment

by:knightEknight
ID: 9876728
Maybe if you use a really really small font, it would load faster.   ;-D
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 10801283
delete IMHO... but it was good for a chuckle.

Cd&
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 10801290
Hence PAQ'ing it... Also for the definition of a Lahk :)
0
 
LVL 31

Expert Comment

by:seanpowell
ID: 10801332
Someone really should be posting Cd& an easy 500 pointer right about now - just to throw him over the top :-)
0
 
LVL 31

Expert Comment

by:seanpowell
ID: 10801336
Actually 254 would just about do it.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 10801341
0
 
LVL 31

Expert Comment

by:seanpowell
ID: 10801345
There you go - I was only a day away from asking it anyways...

http://www.experts-exchange.com/Web/Web_Languages/HTML/Q_20950340.html
0
 
LVL 31

Expert Comment

by:seanpowell
ID: 10801346
Drats....

Hey That's not allowed :-)
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 10801800
Definitely worth PAQing now as evidence of a conspiricy.  <G>

Cd&
0
 
LVL 31

Expert Comment

by:seanpowell
ID: 10801924
ROFL - I concur :-)
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 10967244
PAQed - no points refunded (of 125)

modulo
Community Support Moderator
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now