Wednesday, October 12, 2011

Find post back control with JavaScript

<script language="javascript" type="text/javascript">
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
var PostBackCtrl;
function BeginRequestHandler(sender, e) {
PostBackCtrl = e.get_postBackElement();
}

function EndRequestHandler(sender, e) {

if (PostBackCtrl.id.toLowerCase().indexOf("yourcontrolname") > 0 ) {
//This is your control which made post back
//write your code here
}
}
</script>

No comments: