Page_Load and Page_Init get called twice, sometimes!

Discussion in 'ASP .Net' started by Dot net work, Nov 23, 2004.

  1. Dot net work

    Dot net work Guest

    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.
    Dot net work, Nov 23, 2004
    #1
    1. Advertising

  2. Dot net work

    bruce barker Guest

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

    -- bruce (sqlwork.com)



    "Dot net work" <> wrote in message
    news:...
    | 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.
    bruce barker, Nov 23, 2004
    #2
    1. Advertising

  3. Dot net work

    Dot Net Work Guest

    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!
    Dot Net Work, Nov 23, 2004
    #3
  4. Dot net work

    Tony Cheng Guest

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

    "Dot net work" <> wrote in message
    news:...
    > 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.
    Tony Cheng, Nov 24, 2004
    #4
  5. Dot net work

    Dot net work Guest

    I am using IE6 with Windows 2000 Professional.

    "Tony Cheng" <> wrote in message news:<uOoX$>...
    > Which broswer u use ?
    > I have faced this problem on FireFox
    > but it is ok on IE and netscape
    >
    > "Dot net work" <> wrote in message
    > news:...
    > > 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.
    Dot net work, Nov 24, 2004
    #5
  6. Dot net work

    Dot net work Guest

    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" <> wrote in message news:<>...
    > look at the generated OnInit code, and you will see the event wireup. check
    > for duplicate entries.
    >
    > -- bruce (sqlwork.com)
    >
    >
    >
    > "Dot net work" <> wrote in message
    > news:...
    > | 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.
    Dot net work, Nov 24, 2004
    #6
  7. Dot net work

    Dot net work Guest

    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" <> wrote in message news:<>...
    > look at the generated OnInit code, and you will see the event wireup. check
    > for duplicate entries.
    >
    > -- bruce (sqlwork.com)
    >
    >
    >
    > "Dot net work" <> wrote in message
    > news:...
    > | 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.
    Dot net work, Nov 24, 2004
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Christian

    Page_Init() and Page_Load()

    Christian, Jul 16, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    668
    Cristian Suazo
    Jul 16, 2003
  2. jack
    Replies:
    4
    Views:
    12,349
    John Saunders
    Aug 1, 2004
  3. doobdave
    Replies:
    3
    Views:
    4,090
    Jeff Evans
    Dec 17, 2004
  4. Nathan Sokalski
    Replies:
    12
    Views:
    15,378
    John Timney \(ASP.NET MVP\)
    Sep 26, 2005
  5. ad
    Replies:
    6
    Views:
    35,515
    Joerg Jooss
    Nov 16, 2005
Loading...

Share This Page