Page_Load

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to determine in Page_Load as a result of what action (what
button click) the form was submitted?

Thank you
 
With autopostback property set to true, there will be two hidden variable in
your form __EVENTTARGET and __EVENTARGUMENT which you can access in
Page_Load event to get the control name which caused the postback.
__EVENTTARGET will have the object which fired the post back event.

Eliyahu
 
AFAIK no

this is a bit of a pain sometimes. you may need to delay doing some
processing until the prerender event.

In one form, I just had all the event handlers set an instance variable
called WhichButtonWasClicked. Then I did all the work in PreRender

Andy
 
Both __EVENTTARGET and __EVENTARGUMENT return null.
I read on the web that some controls reset the value of these hidden fields.
Is there a way to overcome this problem or other ways to determine the
control that submitted the form?

Thanks.
 
execpt in the case of buttons which only pass their name in the postdata.

-- bruce (sqlwork.com)
 
Back
Top