Page_Load and Page_Init get called twice, sometimes!

D

Dot net work

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 AutoEventWireup=True in your page header?"

In my project, I have this set to false - everywhere.

Also, if I keep repeating exactly the same button click action, over
and over again, sometimes the Page_Init and Page_Load gets called
twice, sometimes it just gets called once. It almost appears to be
random.

More specifically, my aspx page contains several web user controls.
On one web user control I have the button in question, and it's when I
click this, that the Page_Init and Page_Load of another web user
control on the same aspx form either gets called once or twice.

What should I do? Do you think something has got muddled up
internally, and I should delete some files and start again?

Thank you,
Regards, dnw.
 
B

bruce barker

look at the generated OnInit code, and you will see the event wireup. check
for duplicate entries.

-- bruce (sqlwork.com)



| 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 AutoEventWireup=True in your page header?"
|
| In my project, I have this set to false - everywhere.
|
| Also, if I keep repeating exactly the same button click action, over
| and over again, sometimes the Page_Init and Page_Load gets called
| twice, sometimes it just gets called once. It almost appears to be
| random.
|
| More specifically, my aspx page contains several web user controls.
| On one web user control I have the button in question, and it's when I
| click this, that the Page_Init and Page_Load of another web user
| control on the same aspx form either gets called once or twice.
|
| What should I do? Do you think something has got muddled up
| internally, and I should delete some files and start again?
|
| Thank you,
| Regards, dnw.
 
D

Dot Net Work

I'm sorry, I don't know what you mean. How do I look at generated
OnInit code? I did a global search for "OnInit" in my project, and
there wasn't a match found.

Apologies for being a bit thick,
-dnw.
 
T

Tony Cheng

Which broswer u use ?
I have faced this problem on FireFox
but it is ok on IE and netscape
 
D

Dot net work

I am using IE6 with Windows 2000 Professional.

Tony Cheng said:
Which broswer u use ?
I have faced this problem on FireFox
but it is ok on IE and netscape
 
D

Dot net work

The Private Sub InitializeComponent() section is always completely
empty, for all of my projects. Is that why I can't seem to find what
you are referring to?

(I'm using VB.NET and VS.Net 2002)

Thanks, dnw.
 
D

Dot net work

I have solved my problem.

I created brand new aspx files, and re-dragged and dropped my existing
web user controls on to them, and now I no longer have the
Page_Init/Page_Load sub routines getting called twice.

-dnw.
 

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

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top