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?
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.
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.
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
...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.
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.