Problem - Multiple executions of Page_Load on 1st entry

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2007
Posts: 23
Reputation: blackbr is an unknown quantity at this point 
Solved Threads: 0
blackbr blackbr is offline Offline
Newbie Poster

Problem - Multiple executions of Page_Load on 1st entry

 
0
  #1
Jan 6th, 2008
asp.net 1.1 + vb.net

I am redirecting to a page with a querystring. The system processes the logic of the page_load sub, hits the end sub, then begins the logic again. It does this only once on first entering the page.

When I debug, I can see this activity... when it hits the end sub the second time, it says it can't find logic to execute, and goes into the disassembly trace.

Also, during debug, it says it can't report the value of session variables.

I've tried: deleting the dll and pdb files, exiting the IDE, building/rebuilding, removing all but one line of the sub. Nothing seems to work.

This does not happen with other pages.

Any ideas would be welcome.

Randy
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 291
Reputation: ericstenson is an unknown quantity at this point 
Solved Threads: 29
Team Colleague
ericstenson's Avatar
ericstenson ericstenson is offline Offline
Posting Whiz in Training

Re: Problem - Multiple executions of Page_Load on 1st entry

 
0
  #2
Jan 6th, 2008
try an if notpostback = true then ... whatever code on pageload ... end if

maybe something in your code is causing it to reload?
--
"Dummy."
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 291
Reputation: ericstenson is an unknown quantity at this point 
Solved Threads: 29
Team Colleague
ericstenson's Avatar
ericstenson ericstenson is offline Offline
Posting Whiz in Training

Re: Problem - Multiple executions of Page_Load on 1st entry

 
0
  #3
Jan 6th, 2008
which could happen if you are setting the value of a control with an autopastback - on setting.
--
"Dummy."
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 23
Reputation: blackbr is an unknown quantity at this point 
Solved Threads: 0
blackbr blackbr is offline Offline
Newbie Poster

Re: Problem - Multiple executions of Page_Load on 1st entry

 
0
  #4
Jan 6th, 2008
ericstenson,

Thanks for the quick reply. When I made the "if not is postback then exit sub" as the 1st lines of the sub, it still executed exactly twice, followed by executing the page_unload sub twice???

There were no autopostback items in the page.

However, I noticed that autoeventwireup for the page was set to true ( a change I had made for other reasons). When I changed that to false, it started working correctly again... any idea why?

Randy
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 23
Reputation: blackbr is an unknown quantity at this point 
Solved Threads: 0
blackbr blackbr is offline Offline
Newbie Poster

Re: Problem - Multiple executions of Page_Load on 1st entry

 
0
  #5
Jan 6th, 2008
OK, I just looked this up on a search.... here's what I found...

When you explicitly set AutoEventWireup to TRUE, Visual Studio .NET or Visual Studio 2005, by default, generates code to bind events to their event-handler methods. At the same time, the ASP.NET page framework automatically calls the event-handler methods based on their predefined names. This can lead to the same event-handler method being called two times when the page runs. Therefore, Microsoft recommends that you always set AutoEventWireup to FALSE while working in Visual Studio .NET.

http://support.microsoft.com/kb/814745
Thanks again,
Randy
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 291
Reputation: ericstenson is an unknown quantity at this point 
Solved Threads: 29
Team Colleague
ericstenson's Avatar
ericstenson ericstenson is offline Offline
Posting Whiz in Training

Re: Problem - Multiple executions of Page_Load on 1st entry

 
0
  #6
Jan 6th, 2008
Interesting...
--
"Dummy."
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the ASP.NET Forum
Thread Tools Search this Thread



Tag cloud for ASP.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC