Do not use on any
shared computer
August 29, 2008 02:58pm pdt
 
[x]
Attachment Details

Page Cycle Question / SW Architecture

Tags: page_load
I've design my app in a non-standard way, primarily because when I started I didn't know how the page cycle worked and so I tried to treat the whole thing like it was happening in Access.   Now I suspect I'm using the page cycle inefficiently (in fact I know I am) and I'm looking for general information to see what I can do about it.

The app uses one "Main Form" for user input data (other than admin stuff).  The Main Form gets its primary data inputs from either a callback string or a hidden field, both of which are loaded by javascript at the client.  

In either case, during PageLoad, this input string is used as parameter to a single function, call it "ProcessTransaction", that is an entry point to a large set of business process classes.  These classes do things like build context menus, format input transaction rows for the gridviews, edit input data, and update accepted transactions to the database.

On return from "ProcessTransaction" I run another function, in the page code behind, call it "BuildPage", that formats the page and does gridview databinds.   In the same code block there's also a default execute of "BuildPage" in case of a simple "Refresh" type submit that doesn't require ProcessTransaction.

PageLoad
   ProcessTransaction
   BuildPage
 or
   BuildPage (on a simple refresh -  BTW, it's a custom refresh button, not F5)

While I kept kind of jury rigging it all into place while I went through my ASP.NET learning curve, it now all works fine, and because the BuildPage executes the gridview databinds, the gridviews somehow automagically know NOT to rebind.

The problem is, which I discovered later, that when I use a regular ASP.NET button, with no client side processing, the software executes PageLoad first, and then executes the button click event.   These buttons typically do things that don't require "ProcessTransaction".  However, they might modify the page appearance or the data selection.  And so I then have to run "BuildPage" again.

PageLoad
   ProcessTransaction
   BuildPage
 or
   BuildPage (on a simple refresh)

Click Event
   (modify data selection)
   BuildPage

Since I can't detect the button event before PageLoad, I can't skip the ProcessTransaction block on the PageLoad pass.

So, I'm trying to figure out if there's someplace else to run ProcessTransaction besides PageLoad, that would cause it to execute AFTER the button click event.

Since this is "just" a performance issue at this point, I'm going to approach any change cautiously, and I recognize I'll have to make sure that all the other PageLoad actions are properly coordinated with ProcessTransaction.

The input I'm looking for from EE is: where I can put ProcessTransaction/BuildPage so that it will run AFTER the runat server buttonclicks...and any warnings that might be associated with that suggested location.

Any guidance on this would be appreciated.

Thanks!




Start your free trial to view this solution
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Question Stats
Zone: Programming
Question Asked By: codequest
Solution Provided By: farsight
Participating Experts: 2
Solution Grade: A
Views: 0
Translate:
Loading Advertisement...
 
[+][-]Assisted Solution by samtran0331

Rank: Genius

Assisted Solution by samtran0331:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by codequest
Author Comment by codequest:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Accepted Solution by farsight
Accepted Solution by farsight:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Assisted Solution by farsight
Assisted Solution by farsight:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by codequest
Author Comment by codequest:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080723-EE-VQP-34