C#几种在客户端跳转
2. Response.Write("<script>window.open(XXX.aspx'',''_blank'')</script>")——原窗口保留,另外新增一個新頁面;
3.Response.Write("<script>window.location=XXX.aspx''</script>")——打開新的頁面,原窗口被代替;
4.Server.Transfer("XXX.aspx")——打開新的頁面;
5.Response.Write("<script>window.showModelessDialog(XXX.aspx'')</script>")——原窗口保留,以對話框形式打開新窗口;
6.Response.Write("<script>window.showModalDialog(XXX.aspx'')</script>")——對話框形式打開新窗口,原窗口被代替;
?
?7....................
?/// <summary>
??? /// 在客戶端彈出消息框并跳轉
??? /// </summary>
??? /// <param name="pageFor"></param>
??? /// <param name="message">待顯示的信息</param>
??? /// <param name="redirectUrl">待跳轉的地址</param>
??? public static void ShowClientMessegeBoxAndRedirect(String message, String redirectUrl)
??? {
??????? HttpContext.Current.Response.Write("<script language=\"javascript\" type=\"text/javascript\">");
??????? HttpContext.Current.Response.Write("alert('" + message + "');");
??????? HttpContext.Current.Response.Write("location.href='" + redirectUrl + "';");
??????? HttpContext.Current.Response.Write("</script>");
??????? HttpContext.Current.Response.End();
??? }
??? /// <summary>
??? /// 測試一下? 看看效果
??? /// </summary>
??? /// <param name="sender"></param>
??? /// <param name="e"></param>
??? protected void btnTest_Click(object sender, EventArgs e)
??? {
??????? ShowClientMessegeBoxAndRedirect("測試成功","http://www.baidu.com/");
??? }?
轉載于:https://www.cnblogs.com/wanglinglong/archive/2009/12/15/1624810.html
總結
以上是生活随笔為你收集整理的C#几种在客户端跳转的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: GdiPlus[21]: IGPPath
- 下一篇: 使用.Net平台构建企业应用系统场(下)