Page_load fires last on postback

Discussion in 'ASP .Net' started by choukrou@yahoo.fr, Nov 6, 2006.

  1. Guest

    Hello everybody!

    Got a nice problem on 1 of my aspx (and only one): It was working
    "perfectly" for 1year and a half. Last week I had to fix a lil bug. I
    do that and test my app. And on the fixed page, on the first load
    everything is allright.

    But on postback, it seems that the Page_load event is the last fired.
    But in this event, obviously, i'm initializing some vars like my
    connection string, to use in my others events and functions. So on the
    first load my vars are ok and everything works, but on the postback,
    when I call my connection string var on the MyDatagrid_ItemCreated and
    it's empty, there's a little big error message...

    My bugfix doesn't seems to be the source of the problem because:
    I fix a function of me, I didn't touched anything else. And it's not a
    function to launch a rocket for the N.A.S.A., just to access a DB and
    return a string.

    I took back my bugged page and replaced my fix by a thing like
    if(true){} And the Page_load still fires after all others events on
    postback.

    I tried to modify another page, but everything works perfectly, the
    page_load is always first.

    Have u any idea to fix this problem? I searched the newsgroups, saw
    like 2 messages with the same problem but nothing very helpfull to try.
    Is that a problem between the chair and the keyboard, or something
    else?

    Thanks for your help by advance and scuse me for my English
    , Nov 6, 2006
    #1
    1. Advertising

  2. Try to use Page_PreInit (or Page_Init) instead of Page_Load.
    It doesn't fix the problem with Page_Load, but it should solve your problem
    widht access to DB


    <> wrote in message
    news:...
    > Hello everybody!
    >
    > Got a nice problem on 1 of my aspx (and only one): It was working
    > "perfectly" for 1year and a half. Last week I had to fix a lil bug. I
    > do that and test my app. And on the fixed page, on the first load
    > everything is allright.
    >
    > But on postback, it seems that the Page_load event is the last fired.
    > But in this event, obviously, i'm initializing some vars like my
    > connection string, to use in my others events and functions. So on the
    > first load my vars are ok and everything works, but on the postback,
    > when I call my connection string var on the MyDatagrid_ItemCreated and
    > it's empty, there's a little big error message...
    >
    > My bugfix doesn't seems to be the source of the problem because:
    > I fix a function of me, I didn't touched anything else. And it's not a
    > function to launch a rocket for the N.A.S.A., just to access a DB and
    > return a string.
    >
    > I took back my bugged page and replaced my fix by a thing like
    > if(true){} And the Page_load still fires after all others events on
    > postback.
    >
    > I tried to modify another page, but everything works perfectly, the
    > page_load is always first.
    >
    > Have u any idea to fix this problem? I searched the newsgroups, saw
    > like 2 messages with the same problem but nothing very helpfull to try.
    > Is that a problem between the chair and the keyboard, or something
    > else?
    >
    > Thanks for your help by advance and scuse me for my English
    >
    >
    Felix Piskunov, Nov 6, 2006
    #2
    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. H Branyan

    Page_Load fires twice

    H Branyan, Oct 22, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    670
    H Branyan
    Oct 22, 2003
  2. Jon
    Replies:
    1
    Views:
    11,329
    George Ter-Saakov
    Jan 13, 2004
  3. Jay Douglas
    Replies:
    7
    Views:
    591
  4. =?Utf-8?B?RXJpayBKZW5zZW4=?=

    CodeBehind But Not Postback - Page_Load fires twice

    =?Utf-8?B?RXJpayBKZW5zZW4=?=, Jul 19, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    3,301
    =?Utf-8?B?RXJpayBKZW5zZW4=?=
    Jul 21, 2005
  5. Replies:
    3
    Views:
    982
Loading...

Share This Page