Response.Write详细介绍
問題一:
Response.Write 后連接Response.Redirect ,則Response.Write無法顯示,直接跳轉(zhuǎn)入Response.Redirect 的頁面。
解決方式:
Response.Write("<script languge='javascript'>alert('成功修改'); window.location.href='index.aspx'</script>");
如果,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ù),則可用以下方法:
?string param = "傳遞的參數(shù)";
Response.Write("<script languge='javascript'>alert('成功修改'); window.location.href='index.aspx?par =" + param + "'</script>");
問題三:
如果在Ajax的UpdatePanel中的按鈕中用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>
可以用注冊客戶端事件的方法解決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);
出自:http://blog.csdn.net/syz_yumeizhou_yy/article/details/6957245
《新程序員》:云原生和全面數(shù)字化實(shí)踐50位技術(shù)專家共同創(chuàng)作,文字、視頻、音頻交互閱讀總結(jié)
以上是生活随笔為你收集整理的Response.Write详细介绍的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 版本效果MoonWarrior coco
- 下一篇: VMware vSphere 5.1 群