Page load and event queue

S

steven.varr

Hi,

The system I am working on handles web page navigation in the following
fashion: When a button is clicked on a web page a post-back is
triggered. The page_load event occurs as usual with the the button
click event occurring afterwards. The button click event then runs the
code to forward the user to the next web page.

My problem is that the page_load event runs a whole load of code that
is unecessary when the button click event is about to forward the user
to another page.

I was hoping that someone could help me with this please? Is there an
event queue, or something similar, that can be examined to see if the
button click event has been raised? If there is, then the page_load
code could simply skip the unecessary code. If there isn't than I
imagine just passing a flag is the best way to skip the code.

Many thanks,
Steve
 
A

Andy Fish

if I have a case like this, I would normally move the code into the
PreRender event

if you do a redirect in the button click, the prerender won't ever be
called. Even if you don't do a redirect you can still set up a flag in the
button click and check that in the PreRender

there is another way which involves inspecting the request object (I can't
remember the exact details OTTOMH) but in this case I think my solution
would be cleaner
 

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

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,273
Latest member
DamonShoem

Latest Threads

Top