473,320 Members | 1,900 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Javascript successful message

Hi,

I want to create a popup to notify a user that the server side process
has completed successfully. I intended to use a javascript alert to do
this, although ideally the icon should be different, but thats another
story . . .

Anyway, on successful completion of the process i use this piece of
code:

Response.Write("<script language=javascript>alert('Process completed
successfully!');</script>");

Which works OK, but if the page is refreshed afterwards the whole
server side process is launched again, resulting in the message box
appearing again.

Is there any way to prevent this? Or an alternative way to achieve the
same results?

Many thanks

Oct 4 '06 #1
7 2802
Off Course. I deduct that you are using ASP.NET technologies. So first you
need to put this script (the response) into the Page_Load event. After this
put the response into an if statment and check the isPostBack Property of the
page ...
--
Raffaele Garofalo
Application Developer
MCP
"Assimalyst" wrote:
Hi,

I want to create a popup to notify a user that the server side process
has completed successfully. I intended to use a javascript alert to do
this, although ideally the icon should be different, but thats another
story . . .

Anyway, on successful completion of the process i use this piece of
code:

Response.Write("<script language=javascript>alert('Process completed
successfully!');</script>");

Which works OK, but if the page is refreshed afterwards the whole
server side process is launched again, resulting in the message box
appearing again.

Is there any way to prevent this? Or an alternative way to achieve the
same results?

Many thanks

Oct 4 '06 #2
Thanks for the suggestion Raffaele, but it doesn't seem to work.

I have placed it in a if post back statement like so:

if (Page.IsPostBack)
{
Response.Write("<script language=javascript>alert('Process
completed');</script>");
}

So it is shows on postback, but when i refresh the page it seems to be
treated as a postback and runs the code again??

Am i missing something?

Any other suggestions?

Thanks
Raffaeu wrote:
Off Course. I deduct that you are using ASP.NET technologies. So first you
need to put this script (the response) into the Page_Load event. After this
put the response into an if statment and check the isPostBack Property of the
page ...
--
Raffaele Garofalo
Application Developer
MCP
"Assimalyst" wrote:
Hi,

I want to create a popup to notify a user that the server side process
has completed successfully. I intended to use a javascript alert to do
this, although ideally the icon should be different, but thats another
story . . .

Anyway, on successful completion of the process i use this piece of
code:

Response.Write("<script language=javascript>alert('Process completed
successfully!');</script>");

Which works OK, but if the page is refreshed afterwards the whole
server side process is launched again, resulting in the message box
appearing again.

Is there any way to prevent this? Or an alternative way to achieve the
same results?

Many thanks
Oct 4 '06 #3
"Assimalyst" <c_******@hotmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
So it is shows on postback, but when i refresh the page it seems to be
treated as a postback and runs the code again??

Am i missing something?
Yes - refreshing the page performs the last action on that page, so if the
last action was a postback, refreshing the page will run the postback
again...
Oct 4 '06 #4
Very strange because you need to check in Page_Load event if the page is
PostBacked or not and show the Popup only 1 time ...
Mmm you can try to work with Session maybe and check it.
--
Raffaele Garofalo
Application Developer
MCP
"Assimalyst" wrote:
Thanks for the suggestion Raffaele, but it doesn't seem to work.

I have placed it in a if post back statement like so:

if (Page.IsPostBack)
{
Response.Write("<script language=javascript>alert('Process
completed');</script>");
}

So it is shows on postback, but when i refresh the page it seems to be
treated as a postback and runs the code again??

Am i missing something?

Any other suggestions?

Thanks
Raffaeu wrote:
Off Course. I deduct that you are using ASP.NET technologies. So first you
need to put this script (the response) into the Page_Load event. After this
put the response into an if statment and check the isPostBack Property of the
page ...
--
Raffaele Garofalo
Application Developer
MCP
"Assimalyst" wrote:
Hi,
>
I want to create a popup to notify a user that the server side process
has completed successfully. I intended to use a javascript alert to do
this, although ideally the icon should be different, but thats another
story . . .
>
Anyway, on successful completion of the process i use this piece of
code:
>
Response.Write("<script language=javascript>alert('Process completed
successfully!');</script>");
>
Which works OK, but if the page is refreshed afterwards the whole
server side process is launched again, resulting in the message box
appearing again.
>
Is there any way to prevent this? Or an alternative way to achieve the
same results?
>
Many thanks
>
>

Oct 4 '06 #5
Yep, using sessions is my next plan thanks.

Yes - refreshing the page performs the last action on that page, so if the
last action was a postback, refreshing the page will run the postback
again...
Is there any way to refresh the page without running the last performed
task?

Thanks again.

Raffaeu wrote:
Very strange because you need to check in Page_Load event if the page is
PostBacked or not and show the Popup only 1 time ...
Mmm you can try to work with Session maybe and check it.
--
Raffaele Garofalo
Application Developer
MCP
"Assimalyst" wrote:
Thanks for the suggestion Raffaele, but it doesn't seem to work.

I have placed it in a if post back statement like so:

if (Page.IsPostBack)
{
Response.Write("<script language=javascript>alert('Process
completed');</script>");
}

So it is shows on postback, but when i refresh the page it seems to be
treated as a postback and runs the code again??

Am i missing something?

Any other suggestions?

Thanks
Raffaeu wrote:
Off Course. I deduct that you are using ASP.NET technologies. So first you
need to put this script (the response) into the Page_Load event. After this
put the response into an if statment and check the isPostBack Property of the
page ...
--
Raffaele Garofalo
Application Developer
MCP
>
>
"Assimalyst" wrote:
>
Hi,

I want to create a popup to notify a user that the server side process
has completed successfully. I intended to use a javascript alert to do
this, although ideally the icon should be different, but thats another
story . . .

Anyway, on successful completion of the process i use this piece of
code:

Response.Write("<script language=javascript>alert('Process completed
successfully!');</script>");

Which works OK, but if the page is refreshed afterwards the whole
server side process is launched again, resulting in the message box
appearing again.

Is there any way to prevent this? Or an alternative way to achieve the
same results?

Many thanks
Oct 4 '06 #6
"Assimalyst" <c_******@hotmail.comwrote in message
news:11**********************@k70g2000cwa.googlegr oups.com...
>Yes - refreshing the page performs the last action on that page, so if
the
last action was a postback, refreshing the page will run the postback
again...

Is there any way to refresh the page without running the last performed
task?
Not as far as I know, though you might get a more definitive answer on
microsoft.public.dotnet.framework.aspnet
Oct 5 '06 #7
No this is not possible.

--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
-------------------------------------------------------
"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:er**************@TK2MSFTNGP03.phx.gbl...
"Assimalyst" <c_******@hotmail.comwrote in message
news:11**********************@k70g2000cwa.googlegr oups.com...
>>Yes - refreshing the page performs the last action on that page, so if
the
last action was a postback, refreshing the page will run the postback
again...

Is there any way to refresh the page without running the last performed
task?

Not as far as I know, though you might get a more definitive answer on
microsoft.public.dotnet.framework.aspnet

Oct 6 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the...
6
by: Andy Fish | last post by:
Hi, I want to use an anchor tag to invoke some javascript and I've read that it's bad form to use <a href="javascript:foo()"> I've read endless usenet posts and hint sites on the net, they all...
19
by: dmiller23462 | last post by:
Hi guys....I have absolutely NO IDEA what I'm doing with Javascript but my end result is I need two text boxes to stay hidden until a particular option is selected....I've cobbled together the...
3
by: Dan | last post by:
Hi Does anyone know of a good Javascript typewriter ticker that allows you to insert HTML into the ticker. I have found lots but when HTML is inserted, the ticker pauses at the point it reaches...
136
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
5
by: | last post by:
Hi all, Has anyone been able to write some custom javascript on the onclick event of submit button to do certain things like disable submit button, only submit form once etc. This was a breeze...
6
by: @sh | last post by:
I know this is probably a real simple one, but I'm obviously missing something.. I'm building a function that I'll use throughout a website in the situation that I have two text boxes - the two...
1
by: ozzy.osborn | last post by:
Hello All, I have been struggling with a cross browser solution to loading external javascript files on the fly. I have been successful using the following code in IE6: var newScr =...
20
by: twigster | last post by:
Hey everyone, I'm looking for a good way to obfuscate some Javascript code. Does anyone have a good experience or bad experience with a particular software? thanks
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.