/// <summary>
/// 页面跳转,含提示
/// </summary>
/// <param name="strMsg"></param>
/// <param name="strUrl"></param>
public void TransferTo(string strUrl, string strMsg)
{
if (string.IsNullOrEmpty(strMsg))
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", string.Format("<script>window.location.href='{0}'</script>", strUrl));
}
else
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", string.Format("<script>alert('{0}');window.location.href='{1}'</script>", strMsg, strUrl));
}
}
/// <summary>
/// 注册弹出消息并关闭当前窗口及刷新后台页面
/// </summary>
/// <param name="mgs"></param>
public void RegistJSRefushOpenForm(string mgs)
{
string message = string.Format("alert(\"{0}\");window.opener.location.href=window.opener.location.href; self.close()", mgs);
string script = " <script language=\"javascript\" type=\"text/javascript\"> " + message + "</script>";
Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", script);
}
/// <summary>
/// 提示错误后,关闭弹出窗
/// </summary>
/// <param name="strMsg"></param>
public void TransferToParent(string strMsg)
{
if (string.IsNullOrEmpty(strMsg))
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "closePop", string.Format("<script>window.frameElement.cancelPopUp();</script>"));
}
else
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "closePop", string.Format("<script>alert('{0}');window.frameElement.cancelPopUp();</script>", strMsg));
}
}