Asp.Net: Determine Server Side Event Name of Post Back Control

  • Thread starter Thread starter Kieron
  • Start date Start date
K

Kieron

Hi,

How do I reliably find the name of the event (e.g Click,
SelectedIndexChanged etc) that caused a page to post back. Is there somewhere
in the Asp.Net pipelines we can hook into and discover this information
before the event is actually raised?

Thanks,
Kieron
 
First, you're posting to the wrong group. This should be posted to the
ASP.NET newsgroup, not the c# language one.

Events in an ASP.NET page are only created when there is a postback. Since
HTTP is stateless and there is no "invisible connection" between the
server-side classes and the client-side HTML document in your browser.
ASP.Net provides the javascript __doPostBack() function. This records the
name of the object that fired the event, as well as any additional event
information, places it into the hidden form fields __EVENTTARGET and
__EVENTARGUMENT, and then submits the form, initiating your PostBack.


--Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com
 
Hi,


You better post this question in the aspnet NG.

Do not forget to especfy the version too, it might had change from 1.1 to
3.5.
Finally I do not know if you can do that. You should be able to know what
method will be executed in the postback, but what control and/or event sent
it is more difficult, remember that in a worst case escenario this can
change dynamically in the client page.
 
Back
Top