2uzhan.com
Advertisement
Now Place:2uzhan.com » Problem - Multiple executions of Page_Load on 1st entry

Problem - Multiple executions of Page_Load on 1st entry

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

--------------Solutions-------------

try an if notpostback = true then ... whatever code on pageload ... end if

maybe something in your code is causing it to reload?

which could happen if you are setting the value of a control with an autopastback - on setting.

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

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

Interesting...

When a user enters the page in question, a textarea is populated from data from a text file stored on the server. The user can then edit that text (add, ...

I'm attempting to simplify my fundraising page, and would like to show exactly how much each donation would help us out. I've listed the options below, but I would like ...

I have a list.php which displays all the records that is in the database with 2 options Edit or Delete. When clicked its suppose to delete by id but instead ...

Tags:asp.net
© 2018 2uzhan.com Contact