Page_Load - When does it exactly fires?

Discussion in 'ASP .Net' started by M. Ali Qureshi, Jan 7, 2008.

  1. Hi,

    My page has following structure:
    - Page
    ....|-MultiView
    .......|--View1 (Contains a wizard)
    .......|--View2 (Contains another wizard)

    I have following event handlers in my code file

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As
    System.EventArgs) Handles Me.Load '(This handles ofcourse page load)
    Protected Sub HitRaterWiz_Init(ByVal sender As Object, ByVal e As
    System.EventArgs) Handles HitRaterWiz.Init '(This handles init of one wizard
    and adds steps dynamically)
    Protected Sub WeightWiz_Init(ByVal sender As Object, ByVal e As
    System.EventArgs) Handles WeightWiz.Init '(This handles init of sencong
    wizard and adds steps dynamically)

    Could someone tell me in which orders the above 3 events will be fired? I
    assumed that page_load will be fired fist, but apparently its not the case.
    Is it correct? or what i'm doing wrong? How can i get page_load to fire
    first of all?

    Any help will be appreciated.

    Regards
    M. Ali Qureshi, Jan 7, 2008
    #1
    1. Advertising

  2. Hello M. Ali Qureshi,

    what is the HitRaterWiz ?

    Just read the following article about page life cycle
    http://msdn2.microsoft.com/en-us/library/ms178472.aspx
    and see this picture http://blogs.clearscreen.com/dtax/files/aspNET_Page_LifeCycle.jpg

    ---
    WBR,
    Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

    "The greatest danger for most of us is not that our aim is too high and we
    miss it, but that it is too low and we reach it" (c) Michelangelo


    M> Hi,
    M>
    M> My page has following structure:
    M> - Page
    M> ...|-MultiView
    M> ......|--View1 (Contains a wizard)
    M> ......|--View2 (Contains another wizard)
    M> I have following event handlers in my code file
    M>
    M> Protected Sub Page_Load(ByVal sender As Object, ByVal e As
    M> System.EventArgs) Handles Me.Load '(This handles ofcourse page load)
    M> Protected Sub HitRaterWiz_Init(ByVal sender As Object, ByVal e As
    M> System.EventArgs) Handles HitRaterWiz.Init '(This handles init of one
    M> wizard
    M> and adds steps dynamically)
    M> Protected Sub WeightWiz_Init(ByVal sender As Object, ByVal e As
    M> System.EventArgs) Handles WeightWiz.Init '(This handles init of
    M> sencong
    M> wizard and adds steps dynamically)
    M>
    M> Could someone tell me in which orders the above 3 events will be
    M> fired? I assumed that page_load will be fired fist, but apparently
    M> its not the case. Is it correct? or what i'm doing wrong? How can i
    M> get page_load to fire first of all?
    M>
    M> Any help will be appreciated.
    M>
    M> Regards
    M>
    Michael Nemtsev [MVP], Jan 7, 2008
    #2
    1. Advertising

  3. You can set a breakpoint just inside the method body of each handler and find
    out for yourself very easily.
    -- Peter
    Site: http://www.eggheadcafe.com
    UnBlog: http://petesbloggerama.blogspot.com
    MetaFinder: http://www.blogmetafinder.com


    "M. Ali Qureshi" wrote:

    > Hi,
    >
    > My page has following structure:
    > - Page
    > ...|-MultiView
    > ......|--View1 (Contains a wizard)
    > ......|--View2 (Contains another wizard)
    >
    > I have following event handlers in my code file
    >
    > Protected Sub Page_Load(ByVal sender As Object, ByVal e As
    > System.EventArgs) Handles Me.Load '(This handles ofcourse page load)
    > Protected Sub HitRaterWiz_Init(ByVal sender As Object, ByVal e As
    > System.EventArgs) Handles HitRaterWiz.Init '(This handles init of one wizard
    > and adds steps dynamically)
    > Protected Sub WeightWiz_Init(ByVal sender As Object, ByVal e As
    > System.EventArgs) Handles WeightWiz.Init '(This handles init of sencong
    > wizard and adds steps dynamically)
    >
    > Could someone tell me in which orders the above 3 events will be fired? I
    > assumed that page_load will be fired fist, but apparently its not the case.
    > Is it correct? or what i'm doing wrong? How can i get page_load to fire
    > first of all?
    >
    > Any help will be appreciated.
    >
    > Regards
    >
    Peter Bromberg [C# MVP], Jan 7, 2008
    #3
    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:
    668
    H Branyan
    Oct 22, 2003
  2. Jon
    Replies:
    1
    Views:
    11,327
    George Ter-Saakov
    Jan 13, 2004
  3. Jay Douglas
    Replies:
    7
    Views:
    591
  4. bminder
    Replies:
    1
    Views:
    2,153
    nfedin
    Feb 23, 2004
  5. Replies:
    3
    Views:
    981
Loading...

Share This Page