VB.net中Ajaxpro的使用

來源:互聯網
上載者:User

標籤:style   blog   http   color   io   os   使用   ar   java   

1:從網上下載:AjaxPro.2.DLL檔案,:

  http://files.cnblogs.com/wequst/AjaxPro.2.zip

2:解壓之後把DLL放到程式bin目錄下進行參照引用。

3:在WEB.config檔案中進行載入使用:添加以下代碼:

<httpHandlers><add verb="POST,GET" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory,AjaxPro.2"/></httpHandlers>

4:建立測試的VB.net WEB表單程式

  AjaxTest.aspx

5:在上面頁面的後台LOAD事件塊中添加以下的代碼進行DLL的註冊載入:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load        AjaxPro.Utility.RegisterTypeForAjax(GetType(AjaxTest))End Sub

6:在後台中添加需要前台調用的函數

<AjaxPro.AjaxMethod()> Public Function fnAjaxTest(ByVal name As String)        Return (name) End Function

7:前台HTML代碼

<body>    <form id="form1" runat="server">    <div>        <input id="Button1" type="button" value="button" onclick="getajax();" />        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>    </div>    </form></body>

8:JS中調用後台代碼

<head runat="server">    <title>無標題頁</title>     <script type="text/javascript">    function getajax()    {        alert(‘222‘);        WebApplication1.AjaxTest.fnAjaxTest(‘aa‘);        document.getElementById("Label1").innerHTML=‘testaJAX‘;        alert(‘3333‘);      }    </script></head>

這樣完成以上的步驟,整個JS調用背景過程就實現了。

VB.net中Ajaxpro的使用

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.