Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Sample for Alerting user

Reply
Thread Tools

Sample for Alerting user

 
 
susie
Guest
Posts: n/a
 
      12-03-2003
I need a sample to alert user to save the data entry when
he closes the browser.

When a user close the browser, a message box with
following open pops up:

Do you want to save the data before exit?
Yes No Cancel

Can anyone help? I know I need a client script to generate
the msgbox. However I need a sample.

Thank you very much!

 
Reply With Quote
 
 
 
 
Kul
Guest
Posts: n/a
 
      12-03-2003
Check documentation for OnbeforeUnload and OnUnload event in msdn.

Here is some sample code for you, which clicks a button present in form when
user navigates out of this page.

<HTML>
<HEAD>
<script language="javascript">
function ClickSaveBtn(btnName)
{
var oObject = document.all.item(btnName);
if (oObject != null)
{
oObject.click();
}
}
</script>
</HEAD>
<body text="#000000" onbeforeunload="ClickSaveBtn('saveFormDetails')"
bgColor="#ffffff" leftMargin="0" topMargin="0"
onload="setPageHeadingAndStatus('EDUCATION',2," rightMargin="0">
<form id="MyForm" method="post" runat="server">
.....
...//create a button control here with id = "saveFormDetails"

</form>


regards

-Kul


"susie" <(E-Mail Removed)> wrote in message
news:050401c3b948$20c08e60$(E-Mail Removed)...
> I need a sample to alert user to save the data entry when
> he closes the browser.
>
> When a user close the browser, a message box with
> following open pops up:
>
> Do you want to save the data before exit?
> Yes No Cancel
>
> Can anyone help? I know I need a client script to generate
> the msgbox. However I need a sample.
>
> Thank you very much!
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[ANN] RCAP 1.0.0 - Common Alerting Protocol for Ruby Farrel Lifson Ruby 0 04-06-2011 08:30 PM
Alerting Chinese characters - can it be done? Laser Lips Javascript 8 07-06-2010 02:04 PM
RCAP - Common Alerting Protocl for Ruby Farrel Lifson Ruby 1 11-03-2009 08:38 PM
Cisco 500-24 switch alerting on half duplex? edavid3001@gmail.com Cisco 2 11-16-2005 09:34 PM
Alerting the user from code behind Peter Aitken ASP .Net Building Controls 3 08-02-2004 12:48 PM



Advertisments