Vs 2005 中应用 AjaxPro 2.0

正确引用AjaxPro 2.0的dll

web.config
<system.web>
      
<httpHandlers>
          
<add verb="POST,GET" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro.2"/>
      
</httpHandlers>
  
</system.web>
aspx.cs
 1 public partial class _Default : System.Web.UI.Page 
 2 {
 3     protected void Page_Load(object sender, EventArgs e)
 4     {
 5         AjaxPro.Utility.RegisterTypeForAjax(typeof(_Default));
 6     }
 7 
 8     [AjaxPro.AjaxMethod]
 9     public string TestAjaxPro(string s)
10     {
11         return "Hello, AjaxPro!";
12     }
13 }
aspx
 1 <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
 2 
 3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 4 
 5 <html xmlns="http://www.w3.org/1999/xhtml" >
 6 <head runat="server">
 7     <title>无标题页</title>
 8     <script type="text/javascript">
 9         function ClientTestAjaxPro()
10         {
11             //debugger
12             var res = _Default.TestAjaxPro("a", CallBack);
13         }
14         
15         function CallBack(res)
16         {
17        alert(res.value);
18         }
19         
20         function Test_onclick() {
21             ClientTestAjaxPro();
22         }
23 
24     </script>
25 </head>
26 <body>
27     <form id="form1" runat="server">
28         <input id="Test" type="button" value="TestAjaxPro" onclick="return Test_onclick()" />
29         
30     </form>
31 </body>
32 </html>
33 

最近需要用到AjaxPro 2.0
但我还是喜欢微软的ASP.NET Ajax
posted @ 2007-03-02 10:23  KidYang  阅读(1126)  评论(5编辑  收藏  举报