i am having a a开发者_如何学Gosp.net and c#.net application and i have a page gridview.aspx which has a button "close".
when a person closes the browser page by clicking the close icon in the top right of the browser i want to perform the click event of the "close" button,
do we have any event beforebrowserclose()?
No.
WebForms applications use PostBacks to fire off Events. Since the browser doesn't do a PostBack before it closes, there's no way to wire an Event for that.
Unfortunately there's not even a reliable, cross-browser way to accomplish this in Javascript either.
function clickclosebtn() {
if (window.event.clientX < 0 || window.event.clientY < 0)
{
document.getElementById("<%= btnClose.ClientID %>").click();
}
}
精彩评论