1/// <summary>
2 /// 显示消息提示对话框
3 /// </summary>
4 /// <param name="page">当前页面指针,一般为this</param>
5 /// <param name="msg">提示信息</param>
6 public static void Show(System.Web.UI.Page page,string msg)
7 {
8 page.RegisterStartupScript("message","<script language='javascript' defer>alert('"+msg.ToString()
9
10+"');</script>");
11 }
2 /// 显示消息提示对话框
3 /// </summary>
4 /// <param name="page">当前页面指针,一般为this</param>
5 /// <param name="msg">提示信息</param>
6 public static void Show(System.Web.UI.Page page,string msg)
7 {
8 page.RegisterStartupScript("message","<script language='javascript' defer>alert('"+msg.ToString()
9
10+"');</script>");
11 }
1/// <summary>
2 /// 显示消息提示对话框,并进行页面跳转
3 /// </summary>
4 /// <param name="page">当前页面指针,一般为this</param>
5 /// <param name="msg">提示信息</param>
6 /// <param name="url">跳转的目标URL</param>
7 public static void ShowAndRedirect(System.Web.UI.Page page,string msg,string url)
8 {
9 StringBuilder Builder=new StringBuilder();
10 Builder.Append("<script language='javascript' defer>");
11 Builder.AppendFormat("alert('{0}');",msg);
12 Builder.AppendFormat("top.location.href='{0}'",url);
13 Builder.Append("</script>");
14 page.RegisterStartupScript("message",Builder.ToString());
15
16 }
2 /// 显示消息提示对话框,并进行页面跳转
3 /// </summary>
4 /// <param name="page">当前页面指针,一般为this</param>
5 /// <param name="msg">提示信息</param>
6 /// <param name="url">跳转的目标URL</param>
7 public static void ShowAndRedirect(System.Web.UI.Page page,string msg,string url)
8 {
9 StringBuilder Builder=new StringBuilder();
10 Builder.Append("<script language='javascript' defer>");
11 Builder.AppendFormat("alert('{0}');",msg);
12 Builder.AppendFormat("top.location.href='{0}'",url);
13 Builder.Append("</script>");
14 page.RegisterStartupScript("message",Builder.ToString());
15
16 }