page_load fires with ajax call

Discussion in 'ASP .Net' started by Dica, Jul 30, 2007.

  1. Dica

    Dica Guest

    i've got a script that takes about 10 seconds to complete with page_load.
    for that reason, i turned to ajax for additional dynamic updates i needed to
    do on the page without having to force the user through that 10 second
    delay, but it looks like page_load still gets called with an ajax submit. am
    i doing something wrong with my ajax calls or is this normal?

    tks
    Dica, Jul 30, 2007
    #1
    1. Advertising

  2. Dica

    Teemu Keiski Guest

    Hello,

    yes Page_Load is fired on the server even when using AJAX as it is crucial
    part of the page lifecycle, one of the most important events. So if the
    logic is something that must be done, AJAX doesn't help with that since
    there's the initial loading of the Page anyway, and on async postback
    (ajax's post) that same logic would take 10 seconds too, your page just
    isn't halted for that 10 seconds, but you'd still need to wait 10 seconds to
    get the results back.E.g browser doesn't have to stop and wait.

    What you could do is that if you use ASP.NEt Ajax is that you can detect if
    you're in partial postback (ScriptManager.IsInAsyncPostBack
    http://www.asp.net/ajax/documentati..._Web_UI_ScriptManager_IsInAsyncPostBack.aspx),
    so that the logic isn't executed on the additional updates anymore (only on
    the initial load). Another way is to try to make the code execution parallel
    with the page execution by using asynchronous features of ASP.NEt 2.0
    (http://msdn.microsoft.com/msdnmag/issues/05/10/WickedCode/#S2)


    --
    Teemu Keiski
    AspInsider, ASP.NET MVP
    http://blogs.aspadvice.com/joteke
    http://teemukeiski.net


    "Dica" <> wrote in message
    news:A%rri.84234$xk5.25981@edtnps82...
    > i've got a script that takes about 10 seconds to complete with page_load.
    > for that reason, i turned to ajax for additional dynamic updates i needed
    > to do on the page without having to force the user through that 10 second
    > delay, but it looks like page_load still gets called with an ajax submit.
    > am i doing something wrong with my ajax calls or is this normal?
    >
    > tks
    >
    Teemu Keiski, Jul 30, 2007
    #2
    1. Advertising

  3. It is normal.

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA
    http://gregorybeamer.spaces.live.com
    Co-author: Microsoft Expression Web Bible (upcoming)

    ************************************************
    Think outside the box!
    ************************************************
    "Dica" <> wrote in message
    news:A%rri.84234$xk5.25981@edtnps82...
    > i've got a script that takes about 10 seconds to complete with page_load.
    > for that reason, i turned to ajax for additional dynamic updates i needed
    > to do on the page without having to force the user through that 10 second
    > delay, but it looks like page_load still gets called with an ajax submit.
    > am i doing something wrong with my ajax calls or is this normal?
    >
    > tks
    >
    Cowboy \(Gregory A. Beamer\), Jul 30, 2007
    #3
  4. Dica

    chenhong Guest

    can you post you code


    "Dica" <> дÈëÏûÏ¢ÐÂÎÅ:A%rri.84234$xk5.25981@edtnps82...
    > i've got a script that takes about 10 seconds to complete with page_load.
    > for that reason, i turned to ajax for additional dynamic updates i needed
    > to do on the page without having to force the user through that 10 second
    > delay, but it looks like page_load still gets called with an ajax submit.
    > am i doing something wrong with my ajax calls or is this normal?
    >
    > tks
    >
    chenhong, Jul 30, 2007
    #4
  5. Dica

    Masudur Guest

    On Jul 31, 2:38 am, "Dica" <> wrote:
    > i've got a script that takes about 10 seconds to complete with page_load.
    > for that reason, i turned to ajax for additional dynamic updates i needed to
    > do on the page without having to force the user through that 10 second
    > delay, but it looks like page_load still gets called with an ajax submit. am
    > i doing something wrong with my ajax calls or is this normal?
    >
    > tks


    hi
    use Ajax pro... this library don't have that problem
    http://www.ajaxpro.info/


    Thanks
    Md. Masudur Rahman (Munna)
    Kaz Software Ltd.
    www.kaz.com.bd
    http://munnacs.110mb.com
    Masudur, Jul 31, 2007
    #5
  6. Dica

    Dica Guest

    "Teemu Keiski" <> wrote in message
    news:...
    > Hello,
    >
    > yes Page_Load is fired on the server even when using AJAX as it is crucial
    > part of the page lifecycle, one of the most important events. So if the
    > logic is something that must be done, AJAX doesn't help with that since
    > there's the initial loading of the Page anyway, and on async postback
    > (ajax's post) that same logic would take 10 seconds too, your page just
    > isn't halted for that 10 seconds, but you'd still need to wait 10 seconds
    > to get the results back.E.g browser doesn't have to stop and wait.
    >
    > What you could do is that if you use ASP.NEt Ajax is that you can detect
    > if you're in partial postback (ScriptManager.IsInAsyncPostBack
    > http://www.asp.net/ajax/documentati..._Web_UI_ScriptManager_IsInAsyncPostBack.aspx),
    > so that the logic isn't executed on the additional updates anymore (only
    > on the initial load). Another way is to try to make the code execution
    > parallel with the page execution by using asynchronous features of ASP.NEt
    > 2.0 (http://msdn.microsoft.com/msdnmag/issues/05/10/WickedCode/#S2)
    >
    >


    thanks for the links, teemu. your first suggestion works great.

    > --
    > Teemu Keiski
    > AspInsider, ASP.NET MVP
    > http://blogs.aspadvice.com/joteke
    > http://teemukeiski.net
    >
    >
    > "Dica" <> wrote in message
    > news:A%rri.84234$xk5.25981@edtnps82...
    >> i've got a script that takes about 10 seconds to complete with page_load.
    >> for that reason, i turned to ajax for additional dynamic updates i needed
    >> to do on the page without having to force the user through that 10 second
    >> delay, but it looks like page_load still gets called with an ajax submit.
    >> am i doing something wrong with my ajax calls or is this normal?
    >>
    >> tks
    >>

    >
    >
    Dica, Jul 31, 2007
    #6
    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:
    679
    H Branyan
    Oct 22, 2003
  2. Jon
    Replies:
    1
    Views:
    11,375
    George Ter-Saakov
    Jan 13, 2004
  3. Jay Douglas
    Replies:
    7
    Views:
    600
  4. mortb
    Replies:
    0
    Views:
    767
    mortb
    May 4, 2004
  5. Replies:
    3
    Views:
    994
Loading...

Share This Page