Page_Load called twice???

A

Andy

Visual Studio 2003 web form problem using C#.

My Page_Load or OnInit routines seems to be called twice
for every post back to the server.

I have 2 web forms that produce this behaviour, all of
the others just run these routines once.

Any ideas!
 
B

Bret Mulvey [MS]

Is it Page_Load, OnInit, or both? If it's just Page_Load, check if those
two forms have AutoEventWireup="true" in addition to VS.NET's
InitializeComponents() code to attach Page_Load to the OnLoad event.
 
A

Andy

I think it's the Oninit thats being called twice, the
sequence of events is as follows

This bit of code is fired first-

override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}

then the Page_Load is fired
then back to OnInit
then back to Page_Load

All pages have AutoEventWireup set to false.

Cheers Andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top