INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Miscellaneous

Message Boxes AFTER PostBack by akohli
Posted: 17 Dec 03 (Edited 26 Dec 03)

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.

Back to Microsoft: ASP.NET FAQ Index
Back to Microsoft: ASP.NET Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close