Tuesday, April 19, 2011

To find what caused a postback

Sometimes there could be multiple controls on UI and it may be difficult to figure out which control caused the postback while debugging.

1. On aspx/ascx page use following:

Request.Form["__EVENTTARGET"]

2. on a class file use following:

this.Page.Request.Form["__EVENTTARGET"]

No comments:

Post a Comment