470,631 Members | 1,572 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,631 developers. It's quick & easy.

What caused the postback?

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.
Dec 28 '05 #1
2 1472
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/de...nlifecycle.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.

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"news.microsoft.com" wrote:
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.

Dec 28 '05 #2
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 --

Dec 28 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Bisser Milanov | last post: by
1 post views Thread by Patrick.O.Ige | last post: by
9 posts views Thread by Joe | last post: by
3 posts views Thread by Jordan | last post: by
11 posts views Thread by antonyliu2002 | last post: by
6 posts views Thread by Jonathan Wood | last post: by
1 post views Thread by ornit | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.