By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,077 Members | 1,790 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,077 IT Pros & Developers. It's quick & easy.

Page_Load and Page_Init get called twice, sometimes!

P: n/a
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.
Nov 18 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
look at the generated OnInit code, and you will see the event wireup. check
for duplicate entries.

-- bruce (sqlwork.com)

"Dot net work" <do***@hotmail.com> wrote in message
news:77**************************@posting.google.c om...
| 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.
Nov 18 '05 #2

P: n/a
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.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3

P: n/a
Which broswer u use ?
I have faced this problem on FireFox
but it is ok on IE and netscape

"Dot net work" <do***@hotmail.com> wrote in message
news:77**************************@posting.google.c om...
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.

Nov 18 '05 #4

P: n/a
I am using IE6 with Windows 2000 Professional.

"Tony Cheng" <sd***@fdfsds.com> wrote in message news:<uO**************@TK2MSFTNGP11.phx.gbl>...
Which broswer u use ?
I have faced this problem on FireFox
but it is ok on IE and netscape

"Dot net work" <do***@hotmail.com> wrote in message
news:77**************************@posting.google.c om...
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.

Nov 18 '05 #5

P: n/a
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.
"bruce barker" <no***********@safeco.com> wrote in message news:<ef**************@TK2MSFTNGP15.phx.gbl>...
look at the generated OnInit code, and you will see the event wireup. check
for duplicate entries.

-- bruce (sqlwork.com)

"Dot net work" <do***@hotmail.com> wrote in message
news:77**************************@posting.google.c om...
| 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.

Nov 18 '05 #6

P: n/a
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.

"bruce barker" <no***********@safeco.com> wrote in message news:<ef**************@TK2MSFTNGP15.phx.gbl>...
look at the generated OnInit code, and you will see the event wireup. check
for duplicate entries.

-- bruce (sqlwork.com)

"Dot net work" <do***@hotmail.com> wrote in message
news:77**************************@posting.google.c om...
| 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.

Nov 18 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.