Is it possible to identify the postback element within an updatepanel using JavaScript?
I attempted the code below, but args.get_postBackElement().id returns as undefined.
<script>
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
function BeginRequestHandler(sender, args) {
try {
args.get_request().set_userContext(args.get_postBackElement().id);
}
catch (e) {
}
}
function EndRequestHandler(sender, args) {
try {
if (args.get_error() == undefined) {
var sName = args.get_response().get_webRequest().get_userContext();
if (sName == "btnDetails") {
//DoSomething();
}
else {
//DoSomethingelse();
}
}
}
catch (e) {
}
}