How to show alert message while closing the page in asp.net ?


Hi

In our asp.net project so many time we will get a senario to give confirmation alert message whenever somebody click on close icon of page specially in long registration page.

We can do this task using few line of javascript like this.

<script language="JavaScript" type="text/javascript">
window.onbeforeunload = Unload_Call;

function Unload_Call() {
var Message = "Are you sure,do you want to leave this page?";
return Message;
}
</script>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: