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. Taro框架---左滑动删除

    index.js import Taro, { Component } from '@tarojs/taro' import { View,ScrollView } from '@tarojs/com ...

  2. AutoLayout(自动布局)入门

    这是WWDC2012笔记系列中的一篇,完整的笔记列表可以参看这里.如果您是首次来到本站,也许您会有兴趣通过RSS的方式订阅本站. AutoLayout在去年的WWDC上被引入Cocoa,而在今年的WW ...

  3. redis可视化客户端工具TreeNMS

    TreeNMS是一款redis,Memcache可视化客户端工具,采用JAVA开发,实现基于WEB方式对Redis, Memcached数据库进行管理.维护. 功能包括:状态参数监控,NoSQL数据库 ...

  4. 02.万恶之源-python 运算符和编码

    一.流程控制语句if: 第一种语法: (最基本的语法) if 条件: 代码块/结果1 结果2 # 如果条件是真(True)执行结果为1,然后结果为2,如果条件为错(False), 直接结果2. 第二种 ...

  5. 3列滚动抽奖 jquery.slotmachine

    效果图: 需引入js文件: <script src="js/jquery-3.2.0.js"></script> <script src=" ...

  6. Python中好用的模块们

    目录 Python中好用的模块们 datetime模块 subprocess模块 matplotlib折线图 importlib模块 Python中好用的模块们 datetime模块 ​ 相信我们都使 ...

  7. stop slave->reset slave->start slave 复制从哪个位置开始?reset slave all呢?

    reset slave首先来看下当前master-slave情况 mysql> prompt \u@\h,\p:\d>\_ PROMPT set to '\u@\h,\p:\d>\_ ...

  8. 面试系列八 es写入数据的工作原理

    (1)es写数据过程 1)客户端选择一个node发送请求过去,这个node就是coordinating node(协调节点) 2)coordinating node,对document进行路由,将请求 ...

  9. Linux操作系统系列-Linux发布Web项目

    安装JDK 下载jdk 验证是否安装JDK java 如果已经安装了jdk查看已经安装的版本 java -version 如果安装不是所需要的 卸载当前java SDK 通过rpm查看已经安装包 (r ...

  10. 7款外观迷人的HTML5/CSS3 3D特效按钮特效

    下面我整理了7款外观都十分迷人的HTML5/CSS3 3D按钮特效,有几个还挺实用的,分享给大家. 1.CSS3超酷3D弹性按钮 按钮实现非常简单 之前我们分享过几款不错的CSS3 3D立体按钮,比如 ...