What caused the postback?

N

news.microsoft.com

How can I tell which control caused a postback? I have several controls
that cause a postback, and I want to take different actions depending on
which was activated. It seems a little backward that the page load runs
first, then last is the actual event that caused the postback, as that last
event is where all the new parameters are. If I can tell what caused the
postback, then I can at least take action accordingly. Or should I be doing
this a different way?

Thanks for your help.
 
G

Guest

Yes, you should be doing things differently.

Take a brief look at the description of the various stages of the page
cycle:
http://msdn.microsoft.com/library/d...guide/html/cpconcontrolexecutionlifecycle.asp

You would typically use the Load event to perform actions common to all
requests. Then during handling the postback events you would realize which
control made a request. Then you can use the PreRender to do what you
probably were trying to do in the Load event.
 
A

addup

I agree with Phillip, you *should* do things the right way

The answer to your first question may lie with the __EVENTTARGET form
value

-- addup --
 

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,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top