110,571
社区成员
发帖
与我相关
我的任务
分享
Page page = HttpContext.Current.Handler as Page;
page.ClientScript.RegisterStartupScript(page.GetType(),
Guid.NewGuid().ToString(), "<script> alert('注册成功');location.replace('你想跳转的url');</script>");
/// <summary>
/// 弹出对话框,并刷新该页面
/// </summary>
/// <param name="msg">提示信息,例子:"不能为空!"</param>
public void MsgAlertLocation(string msg, string strUrl)
{
Page pg = (Page)HttpContext.Current.Handler;
string script = "alert('" + msg + "');window.location.href='" + strUrl + "';";
//调用Page.ClientScript.RegisterStartupScript方法
pg.ClientScript.RegisterStartupScript(pg.GetType(), Guid.NewGuid().ToString(), script, true);
}
msg.MsgAlertLocation("检索数据失败,请与管理员联系!","'main.html");