473,385 Members | 2,014 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,385 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 994

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...
4
by: David C | last post by:
I spent the last four hours trying to figure out why Page_Load would execute twice. Even stranger was that everything within if (! IsPostBack){....} executed twice as well. There is no rhyme or...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.