Multiple databound dropdown lists

Discussion in 'ASP .Net' started by Lair, Jun 21, 2006.

  1. Lair

    Lair Guest

    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.
     
    Lair, Jun 21, 2006
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:...
    >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.
    >
     
    Steve C. Orr [MVP, MCSD], Jun 21, 2006
    #2
    1. Advertising

  3. Lair

    sloan Guest

    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" <> wrote in message
    news:...
    > 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.
    >
     
    sloan, Jun 21, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andrew Kidd
    Replies:
    3
    Views:
    494
    Andrew Kidd
    Apr 22, 2004
  2. =?UTF-8?B?w4FuZ2VsIEd1dGnDqXJyZXogUm9kcsOtZ3Vleg==

    List of lists of lists of lists...

    =?UTF-8?B?w4FuZ2VsIEd1dGnDqXJyZXogUm9kcsOtZ3Vleg==, May 8, 2006, in forum: Python
    Replies:
    5
    Views:
    433
    =?UTF-8?B?w4FuZ2VsIEd1dGnDqXJyZXogUm9kcsOtZ3Vleg==
    May 15, 2006
  3. rodchar
    Replies:
    0
    Views:
    402
    rodchar
    Nov 26, 2007
  4. Andrew Kidd

    multiple dropdown lists = multiple data readers???

    Andrew Kidd, Apr 20, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    198
    Andrew Kidd
    Apr 21, 2004
  5. Manu
    Replies:
    0
    Views:
    182
Loading...

Share This Page