Friday, March 19, 2010

how to find out what caused the postback

if you are using ajax panel to ajaxify yr web page, you might notice that postback happen for any trigger happens within the ajax panel, this includes date selection in the calendar, button click event and etc.

you might want to find out which control causes the postback to do yr code handling.

the key is to use string control = Request.Form["__EVENTTARGET"]; in page_load event.

The [control] will be null during page load, if the postback is caused by button1, [control] will have the value of button1.

Checkout this artcile to find out more

No comments:

Post a Comment