473,417 Members | 1,530 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,417 software developers and data experts.

Opinions wanted regarding efficiency and drop down list data

I was hoping to get some opinions on the efficiency of various methods of
reusing the same dropdown list data.

Here is the situation:

Multiple panels on maintenance pages with TAB menus across the top showing
different panels. A DropDownList with a 50+ value/text entries exists on
more than one panel but only one will be displayed at a time. Examples might
be US states, countries, category codes, etc.

The query results the dropdownlists are bound to are stored in the
HttpContext.Current.Cache. The data isn't expected to change.

I can...

1. Create the dataset once during the initial page load and bind all
dropdown lists to the same dataset. EnableViewState = true for both
DropDownLists. Both DropDownLists will be in the viewstate sent to the
client and back to the server whether or not the panels are visible but I
won't have to rebind.

2. Turn viewstate off for and rebind the DropDownLists after each page load.
The query results are stored in the cache in an ArrayList of objects. I'd
have to rebind the controls after every load but the size of the viewstate
won't be increased by the data. The query won't be run every time as long as
the query's cache hasn't expired.

3. Put placeholders on the various panels of the web form, manually create a
complete, but non-displayed, DropDownList in code behind with the bound data
in it and store the entire control in the session state. During the
pre-render event of the appropriate panels I clear the placeholder and add
the saved DropDownList to it. I'll have to set the current selected value as
well. I'm not sure if the placeholder unique ID would have the selected
value in the Request.Form value though. I'd have to try it to see if I could
avoid manually placing a value in the viewstate when the selection is
changed. I'd want to clear the session state value when the page is
unloaded.

4. Same as #3 but use the HttpContext.Current.Cache instead of the session
state. The saved DropDownList would be shared with every session. This would
avoid even more querying when the data is fairly static.

I'd be interested in any other ways to efficiently handle DropDownList data.

Thanks for any replies,
Bill
Nov 19 '05 #1
2 1869
Have you thought of making the list a user control (ascx file) and putting
the
fixed data in the outputcache with a long Duration value so it doesnt need
refreshing too often. You can then add mutliple controls to a web page that
uses this data in the ascx control file that wont refresh often.

e.g ascx file using bound data grid:

'Change the following duraction to something huge!
<%@ OutputCache Duration="60" VaryByParam="none" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>

<script language="VB" runat="server">

Sub Page_Load(Src As Object, E As EventArgs)
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter
Dim ds As DataSet

MyConnection = New
SqlConnection("server=(local);database=pubs;Truste d_Connection=yes")
MyCommand = New SqlDataAdapter("select * from Authors",
MyConnection)

ds = New DataSet()
MyCommand.Fill(ds, "Authors")

MyDataGrid.DataSource=new DataView(ds.Tables(0))
MyDataGrid.DataBind()

End Sub

</script>

<ASP:DataGrid id="MyDataGrid" runat="server"
Width="700"
BackColor="#ccccff"
BorderColor="black"
ShowFooter="false"
CellPadding="3"
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
HeaderStyle-BackColor="#aaaadd"
/>

e.g. web form using multiple versions of the control:
<%@ Register TagPrefix="Acme" TagName="DataControl" Src="datactrl.ascx" %>

<Acme:DataControl runat="server" ID="Datacontrol1" NAME="Datacontrol1"/>

<p></p>
<Acme:DataControl runat="server" ID="Datacontrol2" NAME="Datacontrol1"/>


"Wysiwyg" <wy*****@xmissionNSPAM.com> wrote in message
news:cq**********@news.xmission.com...
I was hoping to get some opinions on the efficiency of various methods of
reusing the same dropdown list data.

Here is the situation:

Multiple panels on maintenance pages with TAB menus across the top showing
different panels. A DropDownList with a 50+ value/text entries exists on
more than one panel but only one will be displayed at a time. Examples
might
be US states, countries, category codes, etc.

The query results the dropdownlists are bound to are stored in the
HttpContext.Current.Cache. The data isn't expected to change.

I can...

1. Create the dataset once during the initial page load and bind all
dropdown lists to the same dataset. EnableViewState = true for both
DropDownLists. Both DropDownLists will be in the viewstate sent to the
client and back to the server whether or not the panels are visible but I
won't have to rebind.

2. Turn viewstate off for and rebind the DropDownLists after each page
load.
The query results are stored in the cache in an ArrayList of objects. I'd
have to rebind the controls after every load but the size of the viewstate
won't be increased by the data. The query won't be run every time as long
as
the query's cache hasn't expired.

3. Put placeholders on the various panels of the web form, manually create
a
complete, but non-displayed, DropDownList in code behind with the bound
data
in it and store the entire control in the session state. During the
pre-render event of the appropriate panels I clear the placeholder and add
the saved DropDownList to it. I'll have to set the current selected value
as
well. I'm not sure if the placeholder unique ID would have the selected
value in the Request.Form value though. I'd have to try it to see if I
could
avoid manually placing a value in the viewstate when the selection is
changed. I'd want to clear the session state value when the page is
unloaded.

4. Same as #3 but use the HttpContext.Current.Cache instead of the session
state. The saved DropDownList would be shared with every session. This
would
avoid even more querying when the data is fairly static.

I'd be interested in any other ways to efficiently handle DropDownList
data.

Thanks for any replies,
Bill

Nov 19 '05 #2
I'd be making a control with single DropDownList and a property to get or
set the selected value for the list. I would not be using AutoPostBack. I'd
want the existing selection retained when the displayed panel changes before
the form is submitted to be saved.

I haven't cached user controls yet so I'm wondering...

1. Is the control itself cached on the server or just the rendered html from
the control? If I don't store any protected property variables then it
probably won't matter.

2. If I cache the user control and assuming the viewstate is enabled for the
included DropDownList would each rendered instance of the DropDownList be
stored in the viewstate as well?

3. I saw one book that stated that originally there were two versions of
ASP.NET, the Premium version and the Standard version. The book states that
only the Premium version actually caches although there would be no warning
that the controls weren't actually cached. Currently IIS with ASP.NET always
has caching, correct?

If I don't hear back then I'll try caching a control and see how it behaves.

Thanks for the reply!
Bill

"John Blair" <jo********@hotmail.com> wrote in message
news:HN****************@newsfe6-gui.ntli.net...
Have you thought of making the list a user control (ascx file) and putting
the
fixed data in the outputcache with a long Duration value so it doesnt need
refreshing too often. You can then add mutliple controls to a web page that uses this data in the ascx control file that wont refresh often.

e.g ascx file using bound data grid:

'Change the following duraction to something huge!
<%@ OutputCache Duration="60" VaryByParam="none" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>

<script language="VB" runat="server">

Sub Page_Load(Src As Object, E As EventArgs)
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter
Dim ds As DataSet

MyConnection = New
SqlConnection("server=(local);database=pubs;Truste d_Connection=yes")
MyCommand = New SqlDataAdapter("select * from Authors",
MyConnection)

ds = New DataSet()
MyCommand.Fill(ds, "Authors")

MyDataGrid.DataSource=new DataView(ds.Tables(0))
MyDataGrid.DataBind()

End Sub

</script>

<ASP:DataGrid id="MyDataGrid" runat="server"
Width="700"
BackColor="#ccccff"
BorderColor="black"
ShowFooter="false"
CellPadding="3"
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
HeaderStyle-BackColor="#aaaadd"
/>

e.g. web form using multiple versions of the control:
<%@ Register TagPrefix="Acme" TagName="DataControl" Src="datactrl.ascx" %>

<Acme:DataControl runat="server" ID="Datacontrol1" NAME="Datacontrol1"/>
<p></p>
<Acme:DataControl runat="server" ID="Datacontrol2" NAME="Datacontrol1"/>

"Wysiwyg" <wy*****@xmissionNSPAM.com> wrote in message
news:cq**********@news.xmission.com...
I was hoping to get some opinions on the efficiency of various methods of
reusing the same dropdown list data.

Here is the situation:

Multiple panels on maintenance pages with TAB menus across the top showing different panels. A DropDownList with a 50+ value/text entries exists on
more than one panel but only one will be displayed at a time. Examples
might
be US states, countries, category codes, etc.

The query results the dropdownlists are bound to are stored in the
HttpContext.Current.Cache. The data isn't expected to change.

I can...

1. Create the dataset once during the initial page load and bind all
dropdown lists to the same dataset. EnableViewState = true for both
DropDownLists. Both DropDownLists will be in the viewstate sent to the
client and back to the server whether or not the panels are visible but I won't have to rebind.

2. Turn viewstate off for and rebind the DropDownLists after each page
load.
The query results are stored in the cache in an ArrayList of objects. I'd have to rebind the controls after every load but the size of the viewstate won't be increased by the data. The query won't be run every time as long as
the query's cache hasn't expired.

3. Put placeholders on the various panels of the web form, manually create a
complete, but non-displayed, DropDownList in code behind with the bound
data
in it and store the entire control in the session state. During the
pre-render event of the appropriate panels I clear the placeholder and add the saved DropDownList to it. I'll have to set the current selected value as
well. I'm not sure if the placeholder unique ID would have the selected
value in the Request.Form value though. I'd have to try it to see if I
could
avoid manually placing a value in the viewstate when the selection is
changed. I'd want to clear the session state value when the page is
unloaded.

4. Same as #3 but use the HttpContext.Current.Cache instead of the session state. The saved DropDownList would be shared with every session. This
would
avoid even more querying when the data is fairly static.

I'd be interested in any other ways to efficiently handle DropDownList
data.

Thanks for any replies,
Bill


Nov 19 '05 #3

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

Similar topics

1
by: Dec | last post by:
Ok to simplify things I'll just give an example. This is pretty much what I want to do (minus the postcode): http://www.perrys.co.uk/usedcar?ID=F5J9BNNBMVK00DF I have relatively little...
2
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...
3
by: pmud | last post by:
Hi, I have a drop down list bound to a database thorugh a data reader. It reads the customer names from data reader. Now, I want the user to be able to type more than one alphabet & the list...
5
by: Vigneshwar Pilli via DotNetMonster.com | last post by:
string connectionString1 = "server=(local); user=sa;password=sa; database=sonic"; System.Data.SqlClient.SqlConnection dbConnection1 = new System.Data.SqlClient.SqlConnection(connectionString1);...
1
by: Vamsikrishna Mudrageda | last post by:
Intro: Hi all, my name is Vams, and I am fairly new to postgresql and totally new to mailing lists, so please bare with me. I have used hypersonic sql and mysql, and now I am trying out...
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,...
0
by: weiwei | last post by:
Hi here is my scenario, I create a drop down list in itemtemplate.(that drop down is created from db), after user click edit command, my ideal plan is have another drop down list in...
3
by: Brad Isaacs | last post by:
ASP.NET 2.0 / SQL Server 2000 db / Visual Basic Code behind On my .aspx page I have added an SQL Datasource that contains the SQL query to retrieve the list for my Drop Down List Box. Using...
2
by: Rob Meade | last post by:
Hi all, Ok - I have a few objects I've created, some live in my dal, some in my bol and some in my ui... Here's the thing - I have the need to persist an ID which is used for display purposes...
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
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...

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.