Page_Init() and Page_Load()

Discussion in 'ASP .Net' started by Christian, Jul 16, 2003.

  1. Christian

    Christian Guest

    Hi,

    what is the purpose of having a Page_Init() AND a Page_Load() event handler
    'cause both will always be executed on loading a page ?

    What code do you typically put in one event or in the other event ?

    thanks

    chris
    Christian, Jul 16, 2003
    #1
    1. Advertising

  2. When you need to restore the viewstate of a control on the webpage you
    should create an instace of this webcontrol in the page_init. The reason for
    this is that the viewstate is loaded between the init and the load event. So
    this also means that is you want to access the value of a web control after
    a postback you have to do this after the viewstate has been restored, so you
    can not do this in the page_init.

    This is one example, probably there are some more...

    /Cristian


    "Christian" <> wrote in message
    news:nwhRa.14087$-ops.be...
    > Hi,
    >
    > what is the purpose of having a Page_Init() AND a Page_Load() event

    handler
    > 'cause both will always be executed on loading a page ?
    >
    > What code do you typically put in one event or in the other event ?
    >
    > thanks
    >
    > chris
    >
    >
    Cristian Suazo, Jul 16, 2003
    #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. jack
    Replies:
    4
    Views:
    12,331
    John Saunders
    Aug 1, 2004
  2. Dot net work
    Replies:
    6
    Views:
    5,239
    Dot net work
    Nov 24, 2004
  3. Nathan Sokalski
    Replies:
    12
    Views:
    15,318
    John Timney \(ASP.NET MVP\)
    Sep 26, 2005
  4. ad
    Replies:
    6
    Views:
    35,411
    Joerg Jooss
    Nov 16, 2005
  5. Eric
    Replies:
    1
    Views:
    194
    Evertjan.
    Jun 13, 2009
Loading...

Share This Page