惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

F
Fortinet All Blogs
S
Secure Thoughts
月光博客
月光博客
美团技术团队
雷峰网
雷峰网
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
N
News and Events Feed by Topic
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Forbes - Security
Forbes - Security
W
WeLiveSecurity
P
Proofpoint News Feed
阮一峰的网络日志
阮一峰的网络日志
爱范儿
爱范儿
G
GRAHAM CLULEY
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
AI
AI
Last Week in AI
Last Week in AI
Google Online Security Blog
Google Online Security Blog
Schneier on Security
Schneier on Security
云风的 BLOG
云风的 BLOG
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Recent Announcements
Recent Announcements
Webroot Blog
Webroot Blog
T
Tor Project blog
Cisco Talos Blog
Cisco Talos Blog
N
News and Events Feed by Topic
罗磊的独立博客
The Register - Security
The Register - Security
Blog — PlanetScale
Blog — PlanetScale
T
Threat Research - Cisco Blogs
博客园 - 【当耐特】
Apple Machine Learning Research
Apple Machine Learning Research
人人都是产品经理
人人都是产品经理
T
The Exploit Database - CXSecurity.com
www.infosecurity-magazine.com
www.infosecurity-magazine.com
B
Blog
腾讯CDC
Microsoft Azure Blog
Microsoft Azure Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Engineering at Meta
Engineering at Meta
Latest news
Latest news
IT之家
IT之家
D
DataBreaches.Net
博客园 - 司徒正美
N
Netflix TechBlog - Medium
V
V2EX
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知

博客园 - Juniy

DedeCms 模板学习1 DIV盒子的CSS平面图 在asp.net页面中传递中文参数 - Juniy - 博客园 sqldatasource连接excel 2003 - Juniy - 博客园 SSI与SHTML学习 常用命令备忘 .NET 实现ISAPI过滤器,指定类型文件防下载 ASP.NET"正在中止线程"错误原因 将用户重定向到另一页的几种方法 贝塞尔样条 PetShop4 下载地址 ASCII 非打印控制字符表 (摘抄)什么是反射机制 (摘抄)禁止搜索引擎收录的方法(robots.txt文件的使用) (摘抄)DIV布局和网页设计 ASP.NET(C#)文件读写函数 C#中using的使用 修改url前图标(网上查到) JavaScript小技巧一
AjaxPro(ajax架构)在ASP.NET中的使用
Juniy · 2007-03-19 · via 博客园 - Juniy

1、首先下载AjaxPro 组件。并将AjaxPro.dll引用到网站(或项目)。

2、修改Web.config。在 <system.web> 元素中添加以下代码。

<configuration> 
<system.web>
<httpHandlers>
<!-- Register the ajax handler -->
<add verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax" />
</httpHandlers>
</system.web>
</configuration>
3、对AjaxPro在页Page_Load事件中进行运行时注册。如:
   protected void Page_Load(object sender, EventArgs e)
    {
        AjaxPro.Utility.RegisterTypeForAjax(typeof(_Default));//这的_Default是指页面
         类的类名。如是放在命名空间,则需要写上完整的命名空间(如:namespaces._Default)
    }

4、创建服务器端方法。只要给一个方法加上[AjaxPro.AjaxMethod]标记,
   该方法就变成一个AjaxPro可进行影射调用的方法。如下:
   [AjaxPro.AjaxMethod]
    public string getValue(int a,int b)
    {   
         //该方法我们将实现从客户端传入两个数,在服务器端相加计算后返回到客户端。

        return Convert.ToString(a+b);
    }  

 5、客户端调用。
<script language="javascript">
   function getValue(){   
   _Default.getValue(1,2,getGroups_callback);//该处即调用服务器端的_Default.getValue方法。
               这在里边需要指定个回调函数,以接受服务器端处理完后返回客户端结果。
   form1.TextBox1.value="123";
      }
  
   //这个方法用户接受并处理服务器端返回的结果。
   function getGroups_callback(response){
   var dt=response.value;
   alert(dt);
   }
</script>  
到这一个简单,但已是一个完整的AjaxPro的使用了。
当然AjaxPro 还可做很多更实用的,更强大的功能。这个仅做个抛砖引玉。其它的改天整理后再放上来。