zoukankan      html  css  js  c++  java
  • 页面弹出信息方法

    /// <summary>
            /// 显示消息提示对话框
            /// </summary>
            /// <param name="page">当前页面指针,一般为this</param>
            /// <param name="msg">提示信息</param>
            public static void Show(System.Web.UI.Page page, string msg)
            {
                page.ClientScript.RegisterStartupScript(page.GetType(), "message", "<script language='javascript' defer>alert('" + msg.ToString() + "');</script>");
            }

            /// <summary>
            /// 控件点击 消息确认提示框
            /// </summary>
            /// <param name="page">当前页面指针,一般为this</param>
            /// <param name="msg">提示信息</param>
            public static void ShowConfirm(System.Web.UI.WebControls.WebControl Control, string msg)
            {
                //Control.Attributes.Add("onClick","if (!window.confirm('"+msg+"')){return false;}");
                Control.Attributes.Add("onclick", "return confirm('" + msg + "');");
            }

            /// <summary>
            /// 显示消息提示对话框,并进行页面跳转
            /// </summary>
            /// <param name="page">当前页面指针,一般为this</param>
            /// <param name="msg">提示信息</param>
            /// <param name="url">跳转的目标URL</param>
            public static void ShowAndRedirect(System.Web.UI.Page page, string msg, string url)
            {
                StringBuilder Builder = new StringBuilder();
                Builder.Append("<script language='javascript' defer>");
                Builder.AppendFormat("alert('{0}');", msg);
                Builder.AppendFormat("top.location.href='{0}'", url);
                Builder.Append("</script>");
                page.ClientScript.RegisterStartupScript(page.GetType(), "message", Builder.ToString());

            }
            /// <summary>
            /// 输出自定义脚本信息
            /// </summary>
            /// <param name="page">当前页面指针,一般为this</param>
            /// <param name="script">输出脚本</param>
            public static void ResponseScript(System.Web.UI.Page page, string script)
            {
                page.ClientScript.RegisterStartupScript(page.GetType(), "message", "<script language='javascript' defer>" + script + "</script>");

            }

  • 相关阅读:
    90后是怎么了
    从GNOME切换到KDE了
    Ubuntu 12.04中安装Evolus Pencil原型图绘制软件
    wine qq 2012 for linux
    发现来博客园比去csdn早
    [转]代理(Proxy)和委派(Delegate)的区别
    Debian Stable分支对于开发者的意义[续软件系统。。。]
    xj3d svn org.web3d目录结构分析
    不自觉的就陷入OS发行版选择的泥潭
    DNN Test
  • 原文地址:https://www.cnblogs.com/di305449473/p/1193290.html
Copyright © 2011-2022 走看看