470,648 Members | 1,441 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,648 developers. It's quick & easy.

PAGE_LOAD invoked twice

This event appears to be invoked twice for absolutely no reason on only one
of my ASP.Net web user controls. Although I've now overcome the problem by
overriding the base classes OnLoad routine, I could never figure out why
this event was being invoked twice.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here

End Sub

It inherits from the following superclass:

This is the scenario:

When this 'Page_Load' routine was invoked; the call stack as soon as the
procedure begins shows (when non-user code was viewed) that the base classes
OnLoad routine invoked (by doing what ever it does) it.

The strange thing happened when the routine was exiting; I even removed ALL
of the code from the routine and debugged it whilst dissassembly was shown,
and as soon as the routine exited (via the assembler instruction RET 4) the
routine would IMMEDIATELY invoke again!!!

INFACT, the routine didn't even exit! it immediately went back to the top of
the routine and ran again.

The second time it would reach the end of the procedure (instruction RET 4
again) and would correctly return back to the calling method (OnLoad).

This appeared to be completely unpredictable behaviour; as the containing
code was getting executed twice (since i am expecting only 1 page_load per
build/teardown per object).

I can only theorise that somewhere, unless its a logic error of my own (but
I tested it in a seperate ASP Page, with just the user control removing
LOADS of code to test it; still did it) that its unpredictable behaviour
caused by event handling references.

What I would like to know is this:

Is there any advantages/disadvantages to just overiding the base classes
OnLoad routine?

One obvious advantage is you can chose when to invoke the base classes
OnLoad routine to continue normal processing. But I can't find any

Secondly, has anyone else experienced such behaviour?

Nov 18 '05 #1
0 936

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by RAJ | last post: by
2 posts views Thread by RAJ | last post: by
6 posts views Thread by Dot net work | last post: by
14 posts views Thread by V. Jenks | last post: by
2 posts views Thread by Dave | last post: by
4 posts views Thread by Seraph | last post: by
1 post views Thread by puja | last post: by
11 posts views Thread by fiefie.niles | last post: by
4 posts views Thread by David C | last post: by
1 post views Thread by Korara | last post: by
reply views Thread by warner | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.