472,794 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Most Effective Way? Multiple asp:dropdownlist

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!!
Nov 18 '05 #1
2 1283
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.
--
Joe Fallon

"Harry" <ha************@hotmail.com> wrote in message
news:1c**************************@posting.google.c om...
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!!

Nov 18 '05 #2
Hi,

Thanks for the info.
I don't suppose by any chance you could point me in the direction of
some samples. (sample code c#)
I have had a look, but cant seem to find anything relevant.

Any help appriciated as always.
H


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3

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

Similar topics

0
by: Ganesh Kolappan via .NET 247 | last post by:
Hi I am trying to populate a <asp:dropdownlist> in a XSLT file withdatasource pointing to a C# codebehind file method which returnsa dataview. I am using XSLT extension object. But I am...
1
by: Marius | last post by:
Hi all, I need an asp:dropdownlist on a webform that is databound to a dataset. This works fine and returns the data to populate my dropdownlist. In the DB I only have valid data, but I need a...
1
by: Harry | last post by:
Hi, Just seeing if anyone can help me with a problem I am having with drop down lists. - I have a asp:dropdownlist that gets its values from a database. - The user then selects a value then...
2
by: amessimon | last post by:
I need to display a drop down list which holds up to 250 listitems. I'd like to create this programmatically rather than have to hardcode it into the page. For example <asp:DropDownList...
1
by: Urmal Patel via .NET 247 | last post by:
I have problem with asp:Dropdownlist. I have a dropdownlist control in Page1.aspx and I want to assign value and Text to dropdown list form Page2.aspx from java script function. I am able to assign...
7
by: Lastie | last post by:
Hi all, I’ve got a ‘dropdownlist’ web control and I can add ‘listitem’ no problem. I can also bind data from an SQL database fine. My problem is that I want to do both at the same...
1
by: Xuanly ly via .NET 247 | last post by:
asp:dropdownlist always display infront of everything and I can't make it display behind HELP HELP help!!!. <form id="Form1" method="post" runat="server"> <asp:TextBox id="TextBox1"...
2
by: HH | last post by:
Hi, I have a dropdown list that is datafilled via a SQL table. The text part is always unique. (A list of countries) Each country is assigned one of three numbers. (This being the 'value' of...
1
by: Miguel Dias Moura | last post by:
Hello, I have two questions concerning Asp:DropDownList 1. How to fill a DropDownList from runtime and set its default item? 2. How do use a DropDownList in each datagrid record? All...
2
by: John Smith | last post by:
I have this DataGrid: <asp:datagrid id="dg1" runat="server" AutoGenerateColumns="False"> <Columns> <asp:TemplateColumn HeaderText="SM"> <ItemTemplate> <asp:Label id="Label2" runat="server"...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.