473,545 Members | 2,776 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.NET Drop Down List Fill Method

Hi Guys,

I am currently building a web aplication in ASP.Net. On the onload
event of a page a have a function to populate the many drop down lists
on my page.

I have one parameter table which stores all the values e.g.
Title,Type,Stat us,Property,Occ upation.

I am using a sql string and then populationg my drop down list
e.g.

strSQLQuery = "SELECT * FROM tbl_Parameters WHERE str_ParamType =
'Status'"

The problem that i am having is how best to populate each drop down
list efficiently as i am constantly opening and closing the connection
for each new sql String.

Can anyone point me in the best (or quickest and most efficinet) way to
populate multiple drop down list.

any thanks appreciated
CG

Nov 19 '05 #1
1 2039
If they are lists of data that are used a lot and shared among users, you
could cache them in application state or the cache object in the form of a
DataTable.

Otherwise what you're doing is reasonably efficient. ADO.NET pools database
connections so you're not actually opening and closing as many connections
as you think you are.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"csgraham74 " <cs********@hot mail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
Hi Guys,

I am currently building a web aplication in ASP.Net. On the onload
event of a page a have a function to populate the many drop down lists
on my page.

I have one parameter table which stores all the values e.g.
Title,Type,Stat us,Property,Occ upation.

I am using a sql string and then populationg my drop down list
e.g.

strSQLQuery = "SELECT * FROM tbl_Parameters WHERE str_ParamType =
'Status'"

The problem that i am having is how best to populate each drop down
list efficiently as i am constantly opening and closing the connection
for each new sql String.

Can anyone point me in the best (or quickest and most efficinet) way to
populate multiple drop down list.

any thanks appreciated
CG

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
8553
by: Richard Galli | last post by:
I want viewers to compare state laws on a single subject. Imagine a three-column table with a drop-down box on the top. A viewer selects a state from the list, and that state's text fills the column below. The viewer can select states from the drop down lists above the other two columns as well. If the viewer selects only one, only one...
2
2364
by: ramesh | last post by:
hi, I am using Com+ in my application. It will have InsertRecords,selectRecords,updateRecords function. In the Web Form i have Drop-down list. I want to select records from SQL and add it to this list. I know how to fill the data in the drop-down list. But i don't know how to pass this control to Com+. Do we need to pass like private...
0
1726
by: Giulio Santorini | last post by:
Hi, I've got two drop down list controls. When I select a value from the first one I fill the second one. And when I select a value from the second one I would like to fill another control. But after have choose from the first control and filled the second... when I select something from the second control I have not the post back event! I...
13
5220
by: Leszek Taratuta | last post by:
Hello, I have several drop-down lists on my ASP.NET page. I need to keep data sources of these lists in Session State. What would be the most effective method to serialize this kind of data structures? Thanks for any hints, Leszek Taratuta
3
26266
by: Stephen Adam | last post by:
Hi there, I'm sure i'm missing something really simple here, all i want to do is get the value of the selected item in a list box. Even after much fiddling about last night I still could not get my code to work. Below is some code which highlights my problem. All I want to do is set the lable control's text property to the value of the...
3
2045
by: pmud | last post by:
Hi, I have 2 drop down lists on an asp.Net page. The 1st contains alphabets. When the user selects an alphabet frm the first list, the second drop down list should be populated with names from the sql database, which begin with that alphabet. For this I used an sql data Adapter & created a data set. The user's selection in 1st list is...
2
1912
by: tom c | last post by:
I have a dropdown list box on an ASP.Net 1.1 webform. I populate it from a dataset in code. Everything looks fine and I can see all the values in the dropdownlist. I can select a value and I see that new selected value in the list box. However, when I look for the values in code, I see the original value from the list box. The one that...
2
2395
by: bryan | last post by:
Hi all, I am developing a web app in .net 2.0. I have a few DropDownLists that are used on multiple web forms, these show shop locations and employees. Each DDL is placed inside a Usercontrol and the user controls are placed on the relevant pages.
3
7338
by: penny111 | last post by:
Hi there, For my application, i need to have 3 drop down lists 1. drop down list of folder names 2. drop down list of documents in the folder selected 3. drop down list of instances of the document selected (my application uses the BusinessObjects Java Web Services SDK) The 2nd list is dependent on the 1st, while the 3rd list is...
0
7499
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7432
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7689
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7786
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5076
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3490
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3470
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1044
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
743
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.