Solved

Can I call clientside popup alert programatically with ASP.NET?

Posted on 2009-07-15
2
522 Views
Last Modified: 2013-11-08
I want to display a popup box programatically in an asp.net timer event function.  I can't use the native msgbox function as it won't work on the live webserver so was thinking of calling a javascript function with an alert box.  The javacript function is already in place I just need to call it but I don't know how to do this from the serverside code without triggering an event.  Is there any way I can trigger a button click event or something programatically to call the javascript function?  Basically my timer tick function runs in the background and at the Tick event it should display the popup if certain conditions are met as outlined in the Tick function.

Any help appreciated.  Thanks.

P.S.  Response.Write("<script language='javascript'>alert('hello');</script>") doesn't work for me.
0
Comment
Question by:alankinane
2 Comments
 
LVL 22

Accepted Solution

by:
prairiedog earned 500 total points
ID: 24863611
Try this:

ScriptManager.RegisterStartupScript(Me, Me.GetType(), "alertbox", "alert('Timer.');", True)

Open in new window

0
 

Author Closing Comment

by:alankinane
ID: 31603907
Thank-you very much, it was as simple as that!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now