473,399 Members | 3,401 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,399 software developers and data experts.

PAGE_LOAD invoked twice

RAJ
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:
System.Web.UI.UserControl

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
disadvantages!

Secondly, has anyone else experienced such behaviour?
Nov 18 '05 #1
0 1221

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

Similar topics

0
by: RAJ | last post by:
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...
2
by: RAJ | last post by:
Posting this thread again, can somebody please help me with this. Thanks. This event appears to be invoked twice for absolutely no reason on only one of my ASP.Net web user controls. Although...
4
by: Julia | last post by:
Hi Everyone, I am using webbrowser control to post data to an aspx page. However, for some reason, the aspx page sometimes will execute page_load event twice, and sometimes execute it once. So I...
6
by: Dot net work | last post by:
I've read quite a few threads on these groups about this. When someone says the following: "My Page_Load gets called twice on a button click postback" The replies are: "Do you have...
14
by: V. Jenks | last post by:
I'm a little rusty having not touched .NET for 6 months and I can't remember why Page_Load is happening twice in this code: private void Page_Load(object sender, System.EventArgs e) {...
2
by: Dave | last post by:
Hi, this is a follow-up to an earlier question but I really haven't found a definitive answer in my search If I have a Base and Derived webform, I've found that the dervived Page_Load event...
4
by: Seraph | last post by:
Again, I'm rather new here, so if I fail to follow any etiquette, please forgive me and let me know what I've done wrong, but I think this might interest quite a few people. One of my colleaques...
1
by: puja | last post by:
hi all, I have this .aspx page for which the Page_load event occurs twice. I found out while debugging. After searching google, I tried checking with Page.Ispostback method and also had...
11
by: fiefie.niles | last post by:
I am using ASP.NET 2005 and I have a simple form. Page_Load calls a sub mySub that does not do anything (for testing purposes). But, Page_Load gets called twice. On every single ASPX page in my...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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...

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.