Most Effective Way? Multiple asp:dropdownlist

H

Harry

Hi,

Quick question regarding dropdownlists.

On one page I have 10 asp:dropdownlists.
The user selects an option from a dropdown list and then it updates an
asp:label with the relevant text.
The user must select an option from each dropdown list.

All the dropdownlists are to be populated from a SQL database.
I am currently using the "OnSelectedIndexChanged" to call the function
after each change.
For datafilling the DropDownlists I was going to use ExecuteReader
command in the code. But by doing it this way, I need to open and
close a connection to the database for each datafill of the dropdown
list.
This doesnt seem very efficient to me, so I was wondering what the
experts view was on the most effective and efficient way of doing
this?

Any thoughts welcome and appriciated.

Thanks
H

p.s. - The data for the dropdownlists is all in one table, and I have
to run a seperate query to pull the relevant data out for each list.
p.p.s - I hope that all makes sense!!
 
J

Joe Fallon

It is probably more effective to use a dataset.
Hit the DB once and pull back all the data that would satisfy every
dropdown.
Then use 10 dataviews on the dataset and bind each dropdown to a dataview.
 

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

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top