https://github.com/michaelschwarz/Ajax.NET-Professional

Ajax.NET Professional

Ajax.NET Professional (AjaxPro) is one of the first AJAX frameworks available for Microsoft ASP.NET.

The framework will create proxy JavaScript classes that are used on client-side to invoke methods on the web server with full data type support working on all common web browsers including mobile devices. Return your own classes, structures, DataSets, enums,... as you are doing directly in .NET.

Quick Guide

  • Download the latest Ajax.NET Professional
  • Add a reference to the AjaxPro.2.dll (for the .NET 1.1 Framework use AjaxPro.dll)
  • Add following lines to your web.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<httpHandlers>
<add verb="POST,GET" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro.2"/>
</httpHandlers>
[...]
</system.web>
</configuration>
  • Now, you have to mark your .NET methods with an AjaxMethod attribute
[AjaxPro.AjaxMethod]
public DateTime GetServerTime()
{
return DateTime.Now;
}
  • To use the .NET method on the client-side JavaScript you have to register the methods, this will be done to register a complete class to Ajax.NET
namespace MyDemo
{
public class DefaultWebPage
{
protected void Page_Load(object sender, EventArgs e)
{
AjaxPro.Utility.RegisterTypeForAjax(typeof(DefaultWebPage));
} [AjaxPro.AjaxMethod]
public static DateTime GetServerTime()
{
return DateTime.Now;
}
}
}
  • If you start the web page two JavaScript includes are rendered to the HTML source
  • To call a .NET method form the client-side JavaScript code you can use following syntax
function getServerTime() {
MyDemo.DefaultWebPage.GetServerTime(getServerTime_callback); // asynchronous call
} // This method will be called after the method has been executed
// and the result has been sent to the client.
function getServerTime_callback(res) {
alert(res.value);
}

Ajax.NET-Professional的更多相关文章

  1. 客户端调用服务器端方法——ASP.NET AJAX(Atlas)、Anthem.NET和Ajax.NET Professional实现之小小比较

    前几天曾经发过一篇<ASP.NET AJAX(Atlas)和Anthem.NET——管中窥豹般小小比较>,Jeffrey Zhao说用ASP.NET AJAX中的UpdatePanel似乎 ...

  2. 最新JavaScript、Ajax典藏级学习资料下载分类汇总 (2011年12月21日更新)

    其他网站开发相关资料            超强HTML和xhtml,CSS精品学习资料下载汇总                                               最新htm ...

  3. 掌握 Ajax,第 1 部分: Ajax 入门简介

    转:http://www.ibm.com/developerworks/cn/xml/wa-ajaxintro1.html 掌握 Ajax,第 1 部分: Ajax 入门简介 理解 Ajax 及其工作 ...

  4. C# 开源框架

    一.AOP框架        Encase 是C#编写开发的为.NET平台提供的AOP框架.Encase 独特的提供了把方面(aspects)部署到运行时代码,而其它AOP框架依赖配置文件的方式.这种 ...

  5. C#开源系统大汇总(个人收藏)

    C#开源系统大汇总 一.AOP框架        Encase 是C#编写开发的为.NET平台提供的AOP框架.Encase 独特的提供了把方面(aspects)部署到运行时代码,而其它AOP框架依赖 ...

  6. C#常用开源类库

    一.AOP框架        Encase 是C#编写开发的为.NET平台提供的AOP框架.Encase 独特的提供了把方面(aspects)部署到运行时代码,而其它AOP框架依赖配置文件的方式.这种 ...

  7. .NET平台下开源框架

    一.AOP框架Encase 是C#编写开发的为.NET平台提供的AOP框架.Encase 独特的提供了把方面(aspects)部署到运行时代码,而其它AOP框架依赖配置文件的方式.这种部署方面(asp ...

  8. C#开源系统大汇总

    一.AOP框架 Encase 是C#编写开发的为.NET平台提供的AOP框架.Encase 独特的提供了把方面(aspects)部署到运行时代码,而其它AOP框架依赖配置文件的方式.这种部署方面(as ...

  9. C#开源资源项目

    一.AOP框架 Encase 是C#编写开发的为.NET平台提供的AOP框架.Encase 独特的提供了把方面(aspects)部署到运行时代码,而其它AOP框架依赖配置文件的方式.这种部署方面(as ...

随机推荐

  1. 手机端判断安卓,iso,微信

    var uaContains = function (key) { return navigator.userAgent.toLowerCase().indexOf(key.toLowerCase() ...

  2. C#实现程序开机启动

    如何用c#实现开机启动?其实用c#实现程序的开机启动大致有两种方法,就是写入注册表或者采用服务程序,最近一直研究着用C#来操作注册表,下面介绍的方法便是用注册表来实现程序随开机启动(高手就不用看了,嘿 ...

  3. QtCreator 生成动态库

    在Windows平台上,QtCreator( MinGW4.9.2 )创建动态库,最终生成的文件是libHello.a.Hello.dll和hello.o这3个文件(假设在D:/Lib文件夹下面) 在 ...

  4. import、export 和 export default

    ES6中 在JavaScript ES6中,export与export default均可用于导出常量.函数.文件.模块等. 你可以在其它文件或模块中通过import+(常量 | 函数 | 文件 | ...

  5. Git reset的参数

    (1) 默认的mixed参数:git reset commit_id,将本地版本库的头指针全部重置到指定版本,且会重置暂存区,即这次提交之后的所有变更都移动到未暂存阶段. (2) soft 参数:gi ...

  6. DNS配置-BIND安装配置全过程

    下载地址:ftp://ftp.isc.org/isc/ 下载bind,我下载的是bind-9.11.13.tar.gz 我下载的文件放在/root目录下进入目录解压缩 [root@localhost ...

  7. [NOIP2019模拟赛]夹缝

    夹缝 问题描述: 二维空间内有两面相对放置的,向无限远延伸的镜子,以镜子的方向及其法向量建立坐标系,我们选定一个法向量方向下面称“上”.在镜子上的整数位置,存在着一些传感器,传感器不影响光线的反射,光 ...

  8. phonegap 拍照上传照片

    js代码 可以完全从  phonegap 官网扣下来 使用的是2.3版本的phonegap<script type="text/javascript" src="c ...

  9. [转]NuGet学习笔记(1) 初识NuGet及快速安装使用

    关于NuGet园子里已经有不少介绍及使用经验,本文仅作为自己研究学习NuGet一个记录. 初次认识NuGet是在去年把项目升级为MVC3的时候,当时看到工具菜单多一项Library Package M ...

  10. [JZOJ4684] 【GDOI2017模拟8.11】卡牌游戏

    题目 描述 题目大意 有111到2n2n2n牌,一开始分别给两个人,每人nnn张. 轮流出牌,给出对手出牌的顺序,若自己的牌更大,就记一分. 在中间的某个时刻可以改变游戏规则. 问最大的分数. 思考历 ...