/// <summary>
/// 弹出一个对话框,并跳转到某页面
/// </summary>
/// <param name="ControlName">UpdatePanel的ID</param>
/// <param name="message">弹出的消息</param>
/// <param name="url">跳转的页面,空(即:"")则不跳转,0刷新当前页,1刷新父页及本身,其他则跳转</param>
public static void AjaxShow(Control ControlName, string message, string url)
{
string script = "alert('" + message + "');";
switch (url)
{
case "":
break;
case "0":
script += "window.location.href='" + System.Web.HttpContext.Current.Request.Url.AbsoluteUri + "'";
break;
case "1":
script += "opener.window.form1.submit();";
break;
default:
script += "window.location.href='" + url + "'";
break;
}
ScriptManager.RegisterClientScriptBlock(ControlName, typeof(Control), Guid.NewGuid().ToString(), script, true);
}
/// <summary>
/// 刷新iframe的父页面
/// </summary>
/// <param name="ControlName">UpdatePanel的ID</param>
public static void AjaxRefreshParent(Control ControlName)
{
ScriptManager.RegisterClientScriptBlock(ControlName, typeof(Control), Guid.NewGuid().ToString()
, "parent.location.replace(parent.location.href);", true);
}
/// <summary>
/// 刷新iframe的父页面
/// </summary>
public static void RefreshParent()
{
ClientScriptManager script = ((Page)System.Web.HttpContext.Current.Handler).ClientScript;
script.RegisterStartupScript(typeof(Page), DateTime.Now.ToString(), "<script type='text/javascript'>parent.location.replace(parent.location.href);</script>");
}
/// 弹出一个对话框,并跳转到某页面
/// </summary>
/// <param name="ControlName">UpdatePanel的ID</param>
/// <param name="message">弹出的消息</param>
/// <param name="url">跳转的页面,空(即:"")则不跳转,0刷新当前页,1刷新父页及本身,其他则跳转</param>
public static void AjaxShow(Control ControlName, string message, string url)
{
string script = "alert('" + message + "');";
switch (url)
{
case "":
break;
case "0":
script += "window.location.href='" + System.Web.HttpContext.Current.Request.Url.AbsoluteUri + "'";
break;
case "1":
script += "opener.window.form1.submit();";
break;
default:
script += "window.location.href='" + url + "'";
break;
}
ScriptManager.RegisterClientScriptBlock(ControlName, typeof(Control), Guid.NewGuid().ToString(), script, true);
}
/// <summary>
/// 刷新iframe的父页面
/// </summary>
/// <param name="ControlName">UpdatePanel的ID</param>
public static void AjaxRefreshParent(Control ControlName)
{
ScriptManager.RegisterClientScriptBlock(ControlName, typeof(Control), Guid.NewGuid().ToString()
, "parent.location.replace(parent.location.href);", true);
}
/// <summary>
/// 刷新iframe的父页面
/// </summary>
public static void RefreshParent()
{
ClientScriptManager script = ((Page)System.Web.HttpContext.Current.Handler).ClientScript;
script.RegisterStartupScript(typeof(Page), DateTime.Now.ToString(), "<script type='text/javascript'>parent.location.replace(parent.location.href);</script>");
}