Hi All,
I have an UpdatePanel with 2 buttons. Pressing either of them causes a Postback and the panel gets refreshed.
I'm handling the endRequest event on the client side. Is there a way to determine which of the page elements caused the Postback?
Thanks,
Uzi
Try here:
http://www.eggheadcafe.com/articles/20050609.asp
Hi,
you can determine the postback element on the client side with the PageRequestManager. Attach to the beginRequest event and you can save the postback control. More information here:
http://ajax.asp.net/docs/ClientReference/Sys.WebForms/BeginRequestEventArgsClass/default.aspx
Regards
Marc André
Here is a neat way to get it done:
In the 'BeginRequest' event handler insert the postback element to the UserContext of the WebRequest:
function BeginRequestHandler(sender, args){
var elemName = args.get_postBackElement().id;var request = args.get_request();request.set_userContext(elemName);
}
Then, when the request ends, at the 'EndEvent' get the information from the Response object:
function EndRequestHandler(sender, args){
var response = args.get_response();alert(response._webRequest.get_userContext());
}
Thanks,
Uzi
No comments:
Post a Comment