HOw to find which event had occurred that caused a PostBack?

  • Thread starter Thread starter JollyK
  • Start date Start date
J

JollyK

Hi friends,
This is my question....

From the Page Load event (or Page Init event), I would need to find which
event had occurred that caused a PostBack, for example was it a event fired
from the datagrid that caused a postback, or was it from a linkbutton, or
was it from any other control on the page that have PostBack capabilities ?
I am pretty sure this information is captured somewhere before the event is
sent to its appropiate event-handler.

override protected void OnInit(EventArgs e)
{
/* What do I do Here to find the name of the event caused the post back?
*/
}


I have searched online and found 2 links that are exactly related to my
question that remained unsolved.. The details of these links are over here.

http://www.tek-tips.com/gpviewthread.cfm/qid/450403/pid/796/lev2/4/lev3/32
http://www.tek-tips.com/gviewthread.cfm/pid/855/qid/451624

Can you guys give me a sample code of how this can be achieved.

Thanks alot.

JollyK
 
read this - might help
http://www.sitepoint.com/article/899/4

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
 
Examining Page.Request.Form["__EVENTTARGET"] in the
Page_Load event will give the ID of the control that
caused the postback (with the exception of command
buttons). Does this answer your question?

alex
 
Back
Top