Draw page before Page_Load() ?

D

davepkz

I have a long operation I want to run when my page first appears, so I
put it in Page_Load().

However the browser doesn't draw the contents of the page until after
Page_Load() is complete, though I wish it would.

Am I putting my operation in the wrong place? Where do I put a process
that I want run immediately after the page is first completely shown?

thanks much
dp
 
D

darrel

However the browser doesn't draw the contents of the page until after
Page_Load() is complete, though I wish it would.

The browser draws the page once it receives all the HTML.
Am I putting my operation in the wrong place? Where do I put a process
that I want run immediately after the page is first completely shown?

Once the page is completely shown, it's done with the server. The
transaction is complete. By the time your browser starts getting the HTML,
all your code has already been completely executed server-side.

The only option off the top of my head would be to do all this via ajax.
Load the page, then call the long process you are running via a javascript
call on the page, which will then update the relevant portion via AJAX. Of
course, using AJAX brings in a bunch of accessibility/usability issues that
you'd want to weigh as well.

-Darrel
 
Q

q

What are we talking about? Please state your purpose.

Also, do you mean client-side or server-side?
 
D

davepkz

ok That makes sense. I'm obviously approaching this the wrong way.
Here's the background:

When the user selects to perform a long operation, I want to display a
temp page that says something like "Please wait while we process your
request," then go to the results when done.

So my idea was:
1. When user selects this option, Redirect to a page process.aspx that
has the "Please Wait" message.
2. Page_Load() for process.aspx first performs the long operation, then
when done Redirects to the results.aspx.

But of course this isn't working for the reasons you've explained.
Presumably there is a more effective way to achieve this effect?
dp
 

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,780
Messages
2,569,611
Members
45,278
Latest member
BuzzDefenderpro

Latest Threads

Top