Tutorial :event for the closingof the browser


i am having a asp.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()?



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();       }        }  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »