One way to do this is to declare a global variable of
type string in the code-behind and towards the end of
the method that caused the postback (I am assuming the
postback is required, in my scenario it was), set the
variable to a string that contains an alert e.g.
g_strPopUp = "alert('The procedure has completed
successfully.');"; //(The two semi-colons are not a
typo)
Now, in the aspx page, and this is an old classic ASP
technique, set the onload event for the page equal to
the global variable i.e.
<BODY onload="<%=g_strPopUp%>"
Since the server side code is executed prior to client
side code, the relevant HTML that will be emitted to
the browser will be -
<BODY onload="alert('The procedure has completed
successfully.');"
We did this on our project since we were transitioning
from a client-server PowerBuilder app to an ASP.NET
app, and the users were used to/preferred pop-ups as
opposed to the standard ASP.NET methodology of using
labels. Hope this is of help to you and it would be
interesing to see if this is, if you will, robust
enough to hold up under other scenarios. We have used
this in conjunction with window.close() as well and
that worked just fine too.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.