In reference to my question,
Page.Unload Event inside a Update Panel
I am able to make it work but I got two buttons that do partial post back and then in my script I can do what I want, but I want it to work for just one button not two of them, best thing is button I want to make this request work for is Image button whereas other button is just a simple button. This is a User Control in ASP.NET by the way.
<script type="text/javascript">
// if you use jQuery, you can load them when dom is read.
$(document).ready(function () {
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_initializeRequest(InitializeRequest);
prm.add_endRequest(EndRequest);
});
function InitializeRequest(sender, args) {
}
function EndRequest(sender, args) {
// after update occur on UpdatePanel run the code.
UnloadMsgBox();
}
function UnloadMsgBox()
{
alert("Message");
}
</script>