Get the Element that Raised the Asynchronous Postback using UpdatePanel in JavaScript in ASP.Net AJAX
In ASP.Net AJAX applications, we may get a situation where we need to get the element that raised the AJAX postback from UpdatePanel using JavaScript.
It is possible to get the element that raised the Asynchronous postback from OnInitializeRequest event of PageRequestManager class in client side.
The below code snippet will help us to do the same.
<script language="JavaScript">
function pageLoad()
{
Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(OnInitializeRequest);
}
function OnInitializeRequest(sender, args)
{
alert(args.get_postBackElement().id);
}
</script>
|