Response.Write具体介绍
問題一:
Response.Write 后連接Response.Redirect ,則Response.Write無法顯示,直接跳轉(zhuǎn)入Response.Redirect 的頁面。
解決方案:
Response.Write("<script languge='javascript'>alert('成功改動'); window.location.href='index.aspx'</script>");
假設(shè),script內(nèi)容中含有變量,那么解決方法是:
string a=當(dāng)前的記錄變量;
500){this.resized=true;this.style.width=500;}" align=top>Response.Write("<script language='javascript'>alert('"+a+"成功改動'); window.location.href="/index.aspx'<";/script>");
問題二:
假設(shè)要在連接中傳遞參數(shù),則可用下面方法:
?string param = "傳遞的參數(shù)";
Response.Write("<script languge='javascript'>alert('成功改動'); window.location.href='index.aspx?par =" + param + "'</script>");
問題三:
假設(shè)在Ajax的UpdatePanel中的button中用Response.Redirect()或Response.Write()進(jìn)行URL帶參數(shù)的頁面重定向時出現(xiàn)錯誤。
因為Ajax是無刷新的,而使用Response進(jìn)行帶參重定向時須要刷新頁面。在UpdatePanel下設(shè)置“asp: PostBackTrigger”的“ControlID”為指定的控件名稱就可以,如:
<Triggers>
<asp:PostBackTrigger ControlID="GridView" />
</Triggers>
能夠用注冊client事件的方法解決UpdatePanel中的重定向問題
---------------------------------------------------------------------------
跳轉(zhuǎn)到某一指定頁面Response.Redirect("YxiaoLoan.aspx?Loan="+Ftype+"");??
-------------------------------------------------------------------------
Response.Write("<script languge='javascript'>window.parent.popupContent.Hide();</script>");
Response.Write("<script languge='javascript'>window.parent.grdCarToOther.PerformCallback(" + iCrdID + ");;</script>");
ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "", "alert('" + ex.Message + "');", true);
轉(zhuǎn)載于:https://www.cnblogs.com/yxwkf/p/4070053.html
總結(jié)
以上是生活随笔為你收集整理的Response.Write具体介绍的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Ubuntu 14.10 -- 异次元软
- 下一篇: 卵泡成熟后多久破裂