page_load fires with ajax call

D

Dica

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
 
T

Teemu Keiski

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/documentation/live/mref/P_System_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)
 
M

Masudur

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
 
D

Dica

Teemu Keiski said:
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/documentation/live/mref/P_System_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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top