ASPX page is hitting PageLoad TWICE ?

Aholics.com

Active member
Joined
Jun 15, 2004
Messages
27
Location
San Diego
Programming Experience
10+
I'm about to lose my mind here, and would love some insight, if anyone can muster some up.

In a nutshell, I have a large application. This application has a number of ASPX pages I've created within a project. Some (not all) of these pages are hitting the Page_Load method twice. I have combed through every single line of code between those that do and those that don't hit it twice, and I can not find any differences what-so-ever between them. I have also seen this behavior in some ASCX controls.

Upon tracing, the page simply finishes the Page_Load method, then re-starts it.

I can't for the life of me figure this out, and it's driving me nuts. Please throw some ideas out there if you have any...thanks!

AL
 
Last edited:

Aholics.com

Active member
Joined
Jun 15, 2004
Messages
27
Location
San Diego
Programming Experience
10+
Bah, forgot a very important part of this equation.

The pages or user controls that are exhibiting this behavior are in-line code versions of their code-behind counterparts. Basically, the code-behind version works just fine. However, when I convert the page or user control to an in-line version, it hits the page_load twice.

Hope that helps ?
 

Aholics.com

Active member
Joined
Jun 15, 2004
Messages
27
Location
San Diego
Programming Experience
10+
Haha. Truely amazing how talking something out on a forum all by yourself can cause you to have a revelation. The problem with the in-line version was this:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

After removing "Handles MyBase.Load" it worked fine. Apparently the in-line versions do not need this. <shrugs>

Thanks for letting me talk to myself.
 
Top Bottom