国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
在ajax中不能使用response.whrite()解決方法

在使用ASP.NET AJAX 開發(fā)程序時(shí)候 我們以往經(jīng)常使用 response.write();不能使用。

使用ScriptManager來實(shí)現(xiàn)JS注冊(cè)即可

以前以下代碼現(xiàn)在不能在AJAX環(huán)境下正確運(yùn)行

    protected void Button1_Click(object sender, EventArgs e)
    
{
        Response.Write(
"<script>window.open("http://www.baidu.com/");</script>");
  
    }

我們修改以上代碼 讓他在AJAX下運(yùn)行起來

  這里的ScriptManager.RegisterStartupScript()為靜態(tài)方法,注冊(cè)客戶端腳本。第一個(gè)參數(shù)UpdatePanel1 為JS要輸出到的UpdatePanel,opennewwindow 腳本關(guān)鍵字

    protected void Button1_Click(object sender, EventArgs e)
    
{
        
//Response.Write("<script>window.open("http://www.baidu.com/");</script>");
        ScriptManager.RegisterStartupScript(UpdatePanel1, typeof(UpdatePanel), "opennewwindow""window.open("http://www.baidu.com/");"true);
    }

前臺(tái)ASPX代碼

    <form id="form1" runat="server">
    
<div>
        
<asp:ScriptManager id="ScriptManager1" runat="server">
        
</asp:ScriptManager>
    
    
</div>
        
<asp:UpdatePanel id="UpdatePanel1" runat="server">
            
<contenttemplate>
<asp:Button id="Button1" runat="server" Text="Button"  OnClick="Button1_Click"></asp:Button>
</contenttemplate>
        
</asp:UpdatePanel>
        
   
    
</form>
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
ASP.net:Atlas快速入門之實(shí)戰(zhàn)Atlas-ASP.net技術(shù)
Asp.Net Ajax的兩種基本開發(fā)模式
ASP.NET AJAX入門系列(4):使用UpdatePanel控件(一)
asp.net局部刷新技術(shù)
asp.net UpdateProgress控件的使用
UpdatePanel終于可以上傳文件了!
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服