本文介绍了如何在特定时间显示警报消息作为警报或提醒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用的是Asp,VS2008。 如何显示提醒来自特定时间的消息。就像报警或提醒一样。 i使用了这几个代码但是点击时没有显示消息。 ------------------------------------------------
Hi, I am using Asp,VS2008. How to display alert message from specfic time . just like alarm or reminder. i have used this few code but message is not display on click . ------------------------------------------------
/ displays an alert box with a specified message public static void Alert(string message) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append(@"script language=JavaScript>"); sb.Append(@"alert('" + message + "');"); sb.Append(@"</"); sb.Append(@"script>"); ((System.Web.UI.Page)HttpContext.Current.Handler).RegisterStartupScript(new Guid().ToString(), sb.ToString()); }------------------------------ --------------------
--------------------------------------------------
public static class Alert { /// <summary> /// Shows a client-side JavaScript alert in the browser. /// </summary> /// <param name="message">The message to appear in the alert.</param> public static void Show(string message) { // Cleans the message to allow single quotation marks string cleanMessage = message.Replace("'", "\\'"); string script = "<script type=\"text/javascript\">alert('" + cleanMessage + "');</script>"; // Gets the executing web page Page page = HttpContext.Current.CurrentHandler as Page; // Checks if the handler is a Page and that the script isn't allready on the Page if (page != null && !page.ClientScript.IsClientScriptBlockRegistered("alert")) { page.ClientScript.RegisterClientScriptBlock(typeof(Alert), "alert", script); } } }请帮帮我... ------------------------------------------------ ------------------- 问候 Mukesh
please help me... ------------------------------------------------------------------- Regards Mukesh
推荐答案您可以使用计时器控制并指定显示模态窗口的毫秒间隔 You can use timer control and specify the interval in milli seconds for displaying modal window
您可以参考此链接以获取一些想法这个。 demos.telerik/aspnet-ajax/scheduler/examples/reminders/defaultcs.aspx?#qsf-demo-source [ ^ ] You can refer this link to get some ideas out of this. demos.telerik/aspnet-ajax/scheduler/examples/reminders/defaultcs.aspx?#qsf-demo-source[^]
使用计时器控件。在Timer控件的tick事件中调用javascript函数并显示警告。 设置Timer控件属性的时间。 -SG use a timer control. In tick event of the Timer Control call the javascript function and show the alert. Set the time in Timer control property. -SG
更多推荐
如何在特定时间显示警报消息作为警报或提醒
发布评论