473,545 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Cur rent.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.Cur rent.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 1876
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="no ne" %>
<%@ Import Namespace="Syst em.Data" %>
<%@ Import Namespace="Syst em.Data.SqlClie nt" %>

<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;T rusted_Connecti on=yes")
MyCommand = New SqlDataAdapter( "select * from Authors",
MyConnection)

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

MyDataGrid.Data Source=new DataView(ds.Tab les(0))
MyDataGrid.Data Bind()

End Sub

</script>

<ASP:DataGrid id="MyDataGrid " runat="server"
Width="700"
BackColor="#ccc cff"
BorderColor="bl ack"
ShowFooter="fal se"
CellPadding="3"
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
HeaderStyle-BackColor="#aaa add"
/>

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

<Acme:DataContr ol runat="server" ID="Datacontrol 1" NAME="Datacontr ol1"/>

<p></p>
<Acme:DataContr ol runat="server" ID="Datacontrol 2" NAME="Datacontr ol1"/>


"Wysiwyg" <wy*****@xmissi onNSPAM.com> wrote in message
news:cq******** **@news.xmissio n.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.Cur rent.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.Cur rent.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********@hot mail.com> wrote in message
news:HN******** ********@newsfe 6-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="no ne" %>
<%@ Import Namespace="Syst em.Data" %>
<%@ Import Namespace="Syst em.Data.SqlClie nt" %>

<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;T rusted_Connecti on=yes")
MyCommand = New SqlDataAdapter( "select * from Authors",
MyConnection)

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

MyDataGrid.Data Source=new DataView(ds.Tab les(0))
MyDataGrid.Data Bind()

End Sub

</script>

<ASP:DataGrid id="MyDataGrid " runat="server"
Width="700"
BackColor="#ccc cff"
BorderColor="bl ack"
ShowFooter="fal se"
CellPadding="3"
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
HeaderStyle-BackColor="#aaa add"
/>

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

<Acme:DataContr ol runat="server" ID="Datacontrol 1" NAME="Datacontr ol1"/>
<p></p>
<Acme:DataContr ol runat="server" ID="Datacontrol 2" NAME="Datacontr ol1"/>

"Wysiwyg" <wy*****@xmissi onNSPAM.com> wrote in message
news:cq******** **@news.xmissio n.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.Cur rent.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.Cur rent.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
3431
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 experience with databases (hate being a n00b) but I'm currently attempting to put myself through some sort of crash course.. How far have I got? Ok so...
2
2364
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 list. I know how to fill the data in the drop-down list. But i don't know how to pass this control to Com+. Do we need to pass like private...
3
2463
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 becomes shorter & shorter for the user to choose a value from. For example, suppose the user wants to select the name "Michael" from the dop down...
5
4209
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); System.Data.SqlClient.SqlCommand dbCommand1 = new System.Data.SqlClient.SqlCommand();
1
1355
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 postgresql... and so far, very impressive. GJ dev team. Problem: For the location table, should I use two columns (ID PK, name) or just one column (name...
8
7563
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, ProductName, CategoryID, from tblCategoryProducts Where (CategoryID = @CategoryID)
0
2143
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 edititemtemplate with preselected value from the previous drop down list, so far I can only achieved with the regular drop down list in edititemtemplate with no...
3
14984
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 this SQLDataSource I can retrieve my drop down list data. SELECT DISTINCT responsibleMinister FROM responsibleMinister WHERE languageID =...
2
1143
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 only (control ID) and the only place I can persist this is in one of my objects (session variables are not acceptable)....the problem is - the...
0
7401
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7656
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7423
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5972
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5329
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4945
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3450
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3443
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1884
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.