What is the difference between Page_init and Page_Load event?

Discussion in 'ASP .Net' started by ad, Nov 15, 2005.

  1. ad

    ad Guest

    Hi,
    What is the difference between Page_init and Page_Load event?
    ad, Nov 15, 2005
    #1
    1. Advertising

  2. Hi,

    Here is the difference........

    Page_init
    ------------
    This event is the first event to occur when an ASP.net page is executed,
    this is the event where you should be performing any initialization steps
    that you need to setup or create instances of server controls.
    Its generally advised not to access controls in this event as there is no
    guarantee of the controls been created at this stage, its in this event the
    controls are actually created.
    This event fires only the first time the page is loaded and from the next
    time on a postback Page_init is not fired.

    Page_load
    -------------
    This is the event where most of our work will be done, this event occurs
    when all objects/controls on the page are created and will be available for
    use.

    Unlike Init, this event is loaded everytime when the page is posted back.

    Hope this helps,
    --
    Kannan.V
    Home : http://www.kannanv.com
    Blog : http://kannanv.blogspot.com
    Web : http://www.DotnetLounge.net

    "Any one who has never made a mistake has never tried anything new" - Einstein


    "ad" wrote:

    > Hi,
    > What is the difference between Page_init and Page_Load event?
    >
    >
    >
    =?Utf-8?B?S2FubmFuLlYgW01DU0QubmV0XQ==?=, Nov 15, 2005
    #2
    1. Advertising

  3. ad

    Mark Rae Guest

    "Kannan.V [MCSD.net]" <> wrote in
    message news:...

    > Page_init
    > ------------
    > This event fires only the first time the page is loaded and from the next
    > time on a postback Page_init is not fired.


    Er...are you sure...?
    Mark Rae, Nov 15, 2005
    #3
  4. ad

    ad Guest

    Thanks,
    I have tried!
    The Init event fired everytime when page is postback!


    "Kannan.V [MCSD.net]" <> ¼¶¼g©ó¶l¥ó·s»D:...
    > Hi,
    >
    > Here is the difference........
    >
    > Page_init
    > ------------
    > This event is the first event to occur when an ASP.net page is executed,
    > this is the event where you should be performing any initialization steps
    > that you need to setup or create instances of server controls.
    > Its generally advised not to access controls in this event as there is no
    > guarantee of the controls been created at this stage, its in this event
    > the
    > controls are actually created.
    > This event fires only the first time the page is loaded and from the next
    > time on a postback Page_init is not fired.
    >
    > Page_load
    > -------------
    > This is the event where most of our work will be done, this event occurs
    > when all objects/controls on the page are created and will be available
    > for
    > use.
    >
    > Unlike Init, this event is loaded everytime when the page is posted back.
    >
    > Hope this helps,
    > --
    > Kannan.V
    > Home : http://www.kannanv.com
    > Blog : http://kannanv.blogspot.com
    > Web : http://www.DotnetLounge.net
    >
    > "Any one who has never made a mistake has never tried anything new" -
    > Einstein
    >
    >
    > "ad" wrote:
    >
    >> Hi,
    >> What is the difference between Page_init and Page_Load event?
    >>
    >>
    >>
    ad, Nov 15, 2005
    #4
  5. ad

    Mark Rae Guest

    "ad" <> wrote in message
    news:...

    > The Init event fired everytime when page is postback!


    Yes - it seems to be a common misconception that it doesn't...
    Mark Rae, Nov 15, 2005
    #5
  6. ooops.....soory for that piece of wrong information.
    Thanks Mark for correcting me.
    --
    Kannan.V
    Home : http://www.kannanv.com
    Blog : http://kannanv.blogspot.com
    Web : http://www.DotnetLounge.net

    "Any one who has never made a mistake has never tried anything new" - Einstein


    "Mark Rae" wrote:

    > "ad" <> wrote in message
    > news:...
    >
    > > The Init event fired everytime when page is postback!

    >
    > Yes - it seems to be a common misconception that it doesn't...
    >
    >
    >
    =?Utf-8?B?S2FubmFuLlYgW01DU0QubmV0XQ==?=, Nov 15, 2005
    #6
  7. ad

    Joerg Jooss Guest

    Joerg Jooss, Nov 16, 2005
    #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:
    652
    Cristian Suazo
    Jul 16, 2003
  2. Christian
    Replies:
    0
    Views:
    462
    Christian
    Jul 16, 2003
  3. Jimmy
    Replies:
    5
    Views:
    15,221
    =?Utf-8?B?Sm9yZ2UgTCBNYXRvcyBbTUNTRC5ORVRd?=
    Apr 27, 2005
  4. Nathan Sokalski
    Replies:
    12
    Views:
    15,315
    John Timney \(ASP.NET MVP\)
    Sep 26, 2005
  5. Eric
    Replies:
    1
    Views:
    194
    Evertjan.
    Jun 13, 2009
Loading...

Share This Page