473,396 Members | 2,111 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,396 software developers and data experts.

Dynamic Controls Without Doubling Processing Overhead

When a ASPX page is created with dynamic controls based on what the
user is doing the programmer must recreate the dynamic controls again
on PostBack in the Page_Load so that it's events are wired and are
called like a static control.

Here is the problem that I need to solve. The processing overhead
that occurs to determine what dynamic controls need to be added
involves business logic and a query or queries of data in a sql server
database. I would like to stop querying the database on every
PostBack to cut the processing in half (once for the page_load wireup
and once for the creation of new dynamic controls on the page to be
sent back to the user).

Imagine a web page that creates an table with embeded asp hyperlink
buttons based on a user's selection of criteria in a combo box. The
hyperlink has an event handler that does stuff. If the user clicks on
a hyperlink it will not fire the event handler unless the entire table
with hyperlinks is re-created on page_load. This re-creation of the
entire table is a waste of processing just to execute the one
hyperlink's event.

Any ideas on how to save this processing?
Nov 18 '05 #1
2 2532
Dave,
Quickly I can think of two options.
First off, when you run your business logic and determine which controls
need to be dynamically loaded, you can save the result of that business
logic in the viewstate, which @ postback you can retrieve and reload the
controls. True, you still need to reload all the controls, but from what
you are saying, the performance issue comes with the business logic not the
reloading.

Alternatively, on postback you can take a peak at __EVENTTARGET in
Request.Form (Request.Form["__EVENTTARGET"]) and from that you might be able
to skip reloading the controls and skip directly to the hyperlink event (it
won't get called, but you'll know which control fired the postback and can
call the correct event).

Karl

"Dave Williamson" <dw*********@ivsi.com> wrote in message
news:b8**************************@posting.google.c om...
When a ASPX page is created with dynamic controls based on what the
user is doing the programmer must recreate the dynamic controls again
on PostBack in the Page_Load so that it's events are wired and are
called like a static control.

Here is the problem that I need to solve. The processing overhead
that occurs to determine what dynamic controls need to be added
involves business logic and a query or queries of data in a sql server
database. I would like to stop querying the database on every
PostBack to cut the processing in half (once for the page_load wireup
and once for the creation of new dynamic controls on the page to be
sent back to the user).

Imagine a web page that creates an table with embeded asp hyperlink
buttons based on a user's selection of criteria in a combo box. The
hyperlink has an event handler that does stuff. If the user clicks on
a hyperlink it will not fire the event handler unless the entire table
with hyperlinks is re-created on page_load. This re-creation of the
entire table is a waste of processing just to execute the one
hyperlink's event.

Any ideas on how to save this processing?

Nov 18 '05 #2
In addtion to Karl's post, you might look into caching of your data using
one of the ASP.NET caching methods. The can save trips to the server
without increasing the bandwidth requirements of ViewState.

--
Rocky Moore
www.HintsAndTips.com / Share your tips - Earn rewards
www.MyQuickPoll.com / 2004 Election poll ID #33
www.GotTheAnswerToSpam.com / Block virtually all spam email
www.RJSoft.com/Products/RJContentPanel/ - Free web user template content
control!
"Dave Williamson" <dw*********@ivsi.com> wrote in message
news:b8**************************@posting.google.c om...
When a ASPX page is created with dynamic controls based on what the
user is doing the programmer must recreate the dynamic controls again
on PostBack in the Page_Load so that it's events are wired and are
called like a static control.

Here is the problem that I need to solve. The processing overhead
that occurs to determine what dynamic controls need to be added
involves business logic and a query or queries of data in a sql server
database. I would like to stop querying the database on every
PostBack to cut the processing in half (once for the page_load wireup
and once for the creation of new dynamic controls on the page to be
sent back to the user).

Imagine a web page that creates an table with embeded asp hyperlink
buttons based on a user's selection of criteria in a combo box. The
hyperlink has an event handler that does stuff. If the user clicks on
a hyperlink it will not fire the event handler unless the entire table
with hyperlinks is re-created on page_load. This re-creation of the
entire table is a waste of processing just to execute the one
hyperlink's event.

Any ideas on how to save this processing?

Nov 18 '05 #3

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

Similar topics

7
by: Jack | last post by:
Hi, I am trying to test a sql statement in Access which gives me the error as stated in the heading. The sql statement is built as a part of asp login verification, where the userid and password...
1
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to...
3
by: Leo J. Hart IV | last post by:
OK, here's another question for the experts: I am building a multi-step (3 steps actually) form using a panel for each step and hiding/displaying the appropriate panel/panels depending on which...
4
by: pbb | last post by:
Is it possible to retrieve VB code stored in SQL Server as text and execute it in code behind in an ASP.Net app? I guess what I'm looking for is an object that would have an Execute method that...
7
by: serge | last post by:
How can I run a single SP by asking multiple sales question either by using the logical operator AND for all the questions; or using the logical operator OR for all the questions. So it's always...
11
by: toton | last post by:
Hi, I have little confusion about static memory allocation & dynamic allocation for a cluss member. I have class like class Bar{ public: explicit Bar(){ cout<<"bar default"<<endl; }
9
by: Tarscher | last post by:
hi all, I have this seemingly simple problem. I have lost a lot of time on it though. When a user selects a value from a dropdownlist (static control) a dynamic control is generated. I have...
0
by: Eniac | last post by:
Hi, I've been working on a custom user control that needs to be modified and the validation is causing me headaches. The control used to generate a table of 4 rows x 7 columns to display all...
4
by: =?Utf-8?B?RHlsYW5TbWl0aA==?= | last post by:
I have a WebForm where I'm dynamically creating some controls and I'm having difficulty understanding how the state is being persisted and how to work with it. I've created a simplified example...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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
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...
0
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,...
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
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,...

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.