Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

popup alert message

Status
Not open for further replies.

phytos

Technical User
Oct 20, 2002
15
0
0
CY
i made a simple web application to keep track the phone call in my company, that refreshes ever 1 minute and showing the call that are not acknowledged. is there a way to make a popup message when a new call message was enter the database?

Thanks in advanced
 
You could add a javascript alert to the onload event of your body tag if a certain flag was raised (i.e. when a new database record exists).

--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
can you give me an example?
my programming experience is minimun.
let say i want to have a popup alert for username soso and acknowledge status = no. how can i do that?
 
No. There isn't a way for an event on the server side to "force" a page to a user's browser. The web is request-response. So you can't generate a RESPONSE until the server gets a REQUEST. Your approach to repeatedly reload the page is the proper approach.



Thomas D. Greer

Providing PostScript & PDF
Training, Development & Consulting
 
There are lots of ways to do add a javascript alert to the page load but the easiest method I have found is from the following article:


You basically add a literal control to your page, surroud it in script quotes, add a Protected WithEvents so that the page knows about it and then set the Text property of it to include a javascript alert.

There are other ways such as using Attributes.Add and Page.RegisterStartupScript that you can also use so you may want to look at these alternatives as well.

--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 

here's how i use RegisterStartupScript to do popups. RegisterStartupScript's significance is only making sure the alert doesn't appear twice. there's design concerns you'll become aware of while trying popups, such as the back button will make the messages pop up again, but this should get you started.

Public Sub CreateMessageAlert(ByRef aspxPage As System.Web.UI.Page, _
ByVal strMessage As String, ByVal strKey As String)
Dim strScript As String = "<script language=JavaScript>alert('" _
& strMessage & "')</script>"

If (Not aspxPage.IsStartupScriptRegistered(strKey)) Then
aspxPage.RegisterStartupScript(strKey, strScript)
End If
End Sub


useage from within an aspx:

CreateMessageAlert(me, "Page Successfully Updated!", "yesUpdtMsg")

 
ok, so throw in a script to make the page auto-refresh ala here:


...come to think of it... a messagebox is probably a blocking event, right? would the underlying page be able to refresh before the messagebox was closed? i don't think so. since that's probably the case, displaying the message in a normal control (label?) on the page would be best.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top