提示信息并跳转的目标URL

View Code
 1     /// </summary>
 2     /// <param name="page">当前页面指针,一般为this</param>
 3     /// <param name="msg">提示信息</param>
 4     /// <param name="url">跳转的目标URL</param>
 5     public static void ShowAndRedirect(System.Web.UI.Page page, string msg)
 6     {
 7         StringBuilder Builder = new StringBuilder();
 8         Builder.Append("<script language='javascript' defer>");
 9         Builder.AppendFormat("alert('{0}');", msg);
10         Builder.AppendFormat("top.location.href='{0}'", url);
11         Builder.Append("</script>");
12         page.ClientScript.RegisterStartupScript(page.GetType(), "message", Builder.ToString());
13 
14     }
posted @ 2011-05-10 18:47  DR19  阅读(349)  评论(0编辑  收藏  举报