views:

32

answers:

4

For the registration process, we have 5 different pages which the developer jammed into a single page (each of the 5 sections is a usercontrol).

Only one control is set to visible at a time.

It seems that each control's page_load event is fired at the same time.

Is this a design problem or is it expected behavior?

A: 

The load event will be fired on all the controls on a page at the same point in the Page Lifecycle, yes. That's intended, it's so each control can handle (or not handle) the event and do stuff, like getting data from the database or so on and soforth.

The load event will be triggered whether or not the control is Visible. You may be able to skip the logic without breaking anything by doing something like

 public yadda yadda yadda OnLoad( ... ) {
    if(!this.Visible) return;
    //...
 }

But that would require Visible to be set correctly before Load, and also that the control not break if you suddenly skip all it's logic.

Tom Ritter
A: 

It's expected it calls Load on each control in turn.

Regardless of if the control is visible or not it is still processed on the server.

Saint Gerbil
+1  A: 

That is how they work actually. Since all the controls are on the page at once and you are just using the visible property all the controls load event will be fired. If you want to avoid that, put a multiview on the page with each control in it's own view inside that multiview (have the controls visible be true) then just change the multiviews current view index instead of setting visible/non visible on the user controls.

Solmead
A: 

i do not think, that these are loaded "in paralell". they are just very fast after another.

disable all per default, and enable them once after another in the page.
and only execute their own pageLoad stuff, if they are enabled.

on the other hand, i would strongly suggest, to strip your registration. 5 pages of information is never needed, and just scares possible new users.

cRichter