473,382 Members | 1,329 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Multiple databound dropdown lists

I am creating a page that has three to four databound dropdown lists.
Each one is has different data sometimes from the same table but with a
different where clause. What is the best way to populate the data
onload? Right now it's opening and closing a connection for each
dropdown list/Query. I would like to find a way that I can do all the
queries at once without having to open and close the connection several
times. I am using mysql/ asp.net (VB).

Thanks.

Jun 21 '06 #1
2 1754
Actually the connections are not actually opened and closed as many times as
you think because ADO.NET has built-in connection pooling. Therefore your
technique may be more efficient than you thought.
If you want to gain more efficiency you may be able to call one stored
procedure that returns 4 result sets.
Or you may be able to cache the results so you don't have to requery the
data.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"Lair" <la**********@gmail.com> wrote in message
news:11*********************@b68g2000cwa.googlegro ups.com...
I am creating a page that has three to four databound dropdown lists.
Each one is has different data sometimes from the same table but with a
different where clause. What is the best way to populate the data
onload? Right now it's opening and closing a connection for each
dropdown list/Query. I would like to find a way that I can do all the
queries at once without having to open and close the connection several
times. I am using mysql/ asp.net (VB).

Thanks.

Jun 21 '06 #2

I'd suggest ( like Steve C did)
a stored procedure with multi select statements.

I have a sample at:
http://sholliday.spaces.msn.com/PersonalSpace.aspx 5/24/2006 entry

the datareader allows you to go thru multiple resultSets

...

Or you could create a strongly typed DataSet, and keep all data in it.
and some column that says "DropDownBoxNumber"..

<MyInfoDS>
<EntryItem>
<State>VA</State>
<DDL>1</DDL>
</EntryItem>

<EntryItem>
<State>NC</State>
<DDL>2</DDL>
</EntryItem>

<EntryItem>
<State>VA</State>
<DDL>2</DDL>
</EntryItem>

</MyInfoDS>
Here, VA would show up in DDL(1)
NC and VA would show up in DDL(2)
(use the DataSet.Select method to filter the rows .. )

You have some choices. I think the DataSet idea is fudgy, but it would
work.
If you check my blog: you find a "Web Session Object Holder" .. which you
could incorporate to use as a caching mechism..
if you DDL values seldom change, and you load the page(s) that use them alot
of times.


"Lair" <la**********@gmail.com> wrote in message
news:11*********************@b68g2000cwa.googlegro ups.com...
I am creating a page that has three to four databound dropdown lists.
Each one is has different data sometimes from the same table but with a
different where clause. What is the best way to populate the data
onload? Right now it's opening and closing a connection for each
dropdown list/Query. I would like to find a way that I can do all the
queries at once without having to open and close the connection several
times. I am using mysql/ asp.net (VB).

Thanks.

Jun 21 '06 #3

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

Similar topics

0
by: Toonman | last post by:
I have a webpage with a <form> consisting of a large table grid of dropdown lists used to make changes in a database. Some of these dropdown lists have the same value. I'm trying to make it so...
1
by: dw | last post by:
I want to create a databound dropdown list with "Yes" = 1 and "No" = 0. I set the collection up with the two values and databind it to a binary field (sql server) and the only entry in dropdown...
3
by: ram | last post by:
I have a user control uc (with a dropdownlist uc_dd) that I dynamically add to a pane on a button_click. this pane is hosted on the winform. now when I add two instances of the user control...
0
by: Henke | last post by:
Hi, I have done some research about my problem I have when using the "back button" in IE to go back to a page with two dropdown lists. The both dropdown lists are populated with data. The...
6
by: Mark | last post by:
I have two dropdown lists. Both have autopostback set to true. In both dropdowns, when you select an item from the list, it redirects to the Value property of the dropdown. Nothing fancy. ...
2
by: 23s | last post by:
I have a dropdown bound to a dataview. The binding assigns the dropdown with a SelectedIndex of 0. There is a msgbox in the SelectedIndexChanged event that displays the SelectedIndex property....
3
by: simon | last post by:
hello, i have a form where there are multiple dropdown lists that will all be populated from the same initial data query. i have a vb class defined to make the stored proc call and that returns a...
3
by: Steve | last post by:
I have a databound dropdown in my page. I want to make one of the values the default value. Any ideas? Just to explain further, I have also appended one item to the dropdown, using the...
8
by: Ed Dror | last post by:
Hi there ASP.NET 2.0 VB & SQL Express Lest take Northwind Categories Products as example I create a table that hold these two together and I create a stored procedure like select ProductID,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.