国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

關天asp.net ajax beta中在updatepnael中注冊腳本的解決方案

2019-11-18 16:53:49
字體:
來源:轉載
供稿:網友

最近也在看一些asp.net Ajax 的資料,在網上看到很多人都在問如何在updatepanel中注冊腳本,我也試了一下,不過總是不行,就看了好多資料,最后才知道自己沒有完全理解 ScriptManager.RegisterClientScriptBlock(Control control,Type type,string key, string script,bool addScriptTags),其中的各個參數。(注:RegisterClientScriptBlock是 ScriptManager的一個靜態方法)
          參數詳解:
                           control (Control) :這個參數是注冊腳本塊的控件.如果你是在updatepanel中注冊時,即updatepanel  (應該寫updatepanel的ID).
                            type (Type)        :這個參數是注冊腳本塊控件的類型,即updatepanel的類型。
                           key (String)         :這個參數是腳本酷塊的惟一標識(關鍵字)
                           script (String)      :這個參數是要注冊的腳本字符串.
                         addScriptTags (Boolean) :這個參數表示是否要在您的字符串兩邊使用“<script>”和“</script>”包圍起來.

然后這是我寫的一個簡單的例子:
               
  Html代碼:
                                  <html xmlns="<head runat="server">
    <title>Untitled Page</title>
    <link href="/aspnet_client/System_Web/2_0_50727/CrystalReportWebFormViewer3/
CSS/default.css"
        rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1"   runat="server" />
        <asp:UpdatePanel ID="UpdatePanel1" runat="server" >
            <ContentTemplate>
                <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
            </ContentTemplate>
        </asp:UpdatePanel>
    </form>
</body>
</html>

CS代碼:
    PRotected void Button1_Click(object sender, EventArgs e)
    {
        ScriptManager.RegisterClientScriptBlock(UpdatePanel1, typeof(UpdatePanel), "test", "alert('test');", true);

    }

     以上是我的理解,如果有不正確的地方,請大家糾正,我先放到首頁,其實沒有什么技術含量,主要是用來讓那些還不知道如何注冊的朋友看到.過后dohu可以刪了。
http://m.survivalescaperooms.com/sunlife/archive/2006/11/05/550520.html


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 洪洞县| 和顺县| 玛纳斯县| 武冈市| 兴和县| 吉木萨尔县| 忻城县| 旺苍县| 平安县| 沾益县| 喀喇沁旗| 南昌县| 阿巴嘎旗| 门头沟区| 叙永县| 平舆县| 海阳市| 临泉县| 北安市| 噶尔县| 延长县| 兴文县| 余干县| 托里县| 沙坪坝区| 罗源县| 高雄市| 汨罗市| 留坝县| 肃南| 上饶县| 天台县| 永州市| 丰都县| 凤凰县| 招远市| 玛纳斯县| 孙吴县| 昌邑市| 沾益县| 六盘水市|