ajaxpro.2.dll 简单应用
来源:互联网 发布:南京知臣服饰 编辑:程序博客网 时间:2024/05/22 14:22
1.添加 ajaxpro.2.dll 引用
2.web.config
3.服务器端代码
4.客户端代码
2.web.config
<system.web>
<httpHandlers>
<add verb="*" path="*.ashx" type="AjaxPro.AjaxHandlerFactory,AjaxPro.2"/>
</httpHandlers>
</system.web>
<httpHandlers>
<add verb="*" path="*.ashx" type="AjaxPro.AjaxHandlerFactory,AjaxPro.2"/>
</httpHandlers>
</system.web>
3.服务器端代码
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Ajax : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
AjaxPro.Utility.RegisterTypeForAjax(typeof(Ajax));
}
[AjaxPro.AjaxMethod]
public string GetServerTimeString()
{
System.Threading.Thread.Sleep(2000);
return DateTime.Now.ToString();
}
}
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Ajax : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
AjaxPro.Utility.RegisterTypeForAjax(typeof(Ajax));
}
[AjaxPro.AjaxMethod]
public string GetServerTimeString()
{
System.Threading.Thread.Sleep(2000);
return DateTime.Now.ToString();
}
}
4.客户端代码
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Ajax.aspx.cs" Inherits="Ajax" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>ajaxpro.2.dll 简单应用</title>
<script language="javascript" type="text/javascript">
function ajax_callback(response)
{
document.getElementById("div1").innerHTML = response.value;
}
function getServerTime()
{
document.getElementById("div1").innerHTML = "请稍后,正在获取服务器时间..";
Ajax.GetServerTimeString(ajax_callback);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<div id="div1">点击按钮获取服务器端时间</div>
<input type="button" value=" click " onclick="javascript:getServerTime();" />
</div>
</form>
</body>
</html>
相关文章:http://www.cnblogs.com/wskfire/archive/2007/11/26/973265.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>ajaxpro.2.dll 简单应用</title>
<script language="javascript" type="text/javascript">
function ajax_callback(response)
{
document.getElementById("div1").innerHTML = response.value;
}
function getServerTime()
{
document.getElementById("div1").innerHTML = "请稍后,正在获取服务器时间..";
Ajax.GetServerTimeString(ajax_callback);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<div id="div1">点击按钮获取服务器端时间</div>
<input type="button" value=" click " onclick="javascript:getServerTime();" />
</div>
</form>
</body>
</html>
- ajaxpro.2.dll 简单应用
- AjaxPro.2.dll 基本应用(转)
- ASP.NET中AjaxPro.dll的简单应用
- AjaxPro.dll与AjaxPro.2.dll区别
- AjaxPro的简单应用
- AjaxPro.2.dll
- ajaxpro.2.dll使用
- AjaxPro.2.dll 问题
- ajaxpro.2.dll使用
- ajaxpro.2.dll使用
- 使用ajaxpro.2.dll
- AjaxPro.2.dll 使用指南
- AjaxPro.2.dll基本使用
- AjaxPro.2.dll基本使用
- AjaxPro.2.dll基本使用
- AjaxPro.2.dll基本使用
- AjaxPro.2.dll基本使用
- 关于微软AjaxPro.2.dll使用的简单例子(.Net v4)
- linux文件系统基础知识
- debian下scim的安装
- 这几天做了个BCGControlBar Professional v10.0 中文非安装版
- 接触Groovy
- 监控Undo表空间
- ajaxpro.2.dll 简单应用
- tablespace 的大小和使用情况
- 关于多行form记录取值的问题!
- 软件项目管理
- 软件项目开发流程以及人员职责
- 没事随便说几句
- 读《大话设计模式》---工厂方法模式(factory method)
- java中/r(回车符)使用后的效果
- 源代码统计工具 - SourceCounter 2.1.14.75版放出