前台页面:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="Manage.Web.test" %>
<!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>无标题页</title>
</head>
<body>
<span id="myid"></span>
<form id="form1" runat="server" method="post" >
<div>
<script>
function test() {
TestAjax.ttt();
procs();
}
function procs() {
TestAjax.procs(getStr);
}
function getStr(res) {
if (res.value != null ) {
document.getElementById("myid").innerHTML = res.value +"<br/>";
setTimeout("procs()",500);
}
}
</script>
</div>
<input type="button" value="test" onclick="test();"/>
</form>
</body>
</html>
后台:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using AjaxPro;
using System.Text;
using System.Threading;
namespace Manage.Web
{
[AjaxNamespace("TestAjax")]
public partial class test : System.Web.UI.Page
{
public static string txt = "";
protected void Page_Load(object sender, EventArgs e)
{
Utility.RegisterTypeForAjax(typeof(test));
}
[AjaxPro.AjaxMethod()]
public void ttt()
{
System.Threading.Thread thread = new System.Threading.Thread(new System.Threading.ThreadStart(calculate));
thread.Start();
}
[AjaxPro.AjaxMethod()]
public string procs()
{
if (txt != null)
{
return txt;
}
return string.Empty;
}
public void calculate()
{
for (int i = 0; i < 10; i++)
{
txt += "测试进度条" + i + "<br/>";
Thread.Sleep(1000);
}
}
}
}
至于ajaxpro在asp.net中配置就不用说了,这个都知道的
分享到:
相关推荐
JS Ajax --- 使用AjaxPro 调用后台方法 操作数据库
用AJAX,AJAXPRO,ANTHEM分别实现一个前台JS调用后台函数的实例
利用ajaxpro2 js获取后台数据
利用AjaxPro2实现前后台数据实时交互,里面bin目录包含AjaxPro.2.dll,web.confing文件包含在windows server 2008+IIS 7.0 下如何设置,才能正常使用AjaxPro2
AjaxPro控件前台调用后台方法,很简单。
AJAX安装包 AjaxPro AjaxPro.dll AjaxPro.2 AjaxPro.2.dll
AjaxPro库文件
Visual Stdio Net Aspx页面中实现页面无刷新操作,使页面操作更加的美观,顺畅
AjaxPro.DLL文件及使用方法 JS调用后台代码C#
AjaxPro.2 集成程序 dll文件
AjaxPro文件及使用文档 AjaxPro文件及使用文档
.net中用ajaxpro页面无刷新技术传值
AjaxPro.2.dll AjaxPro.dll Ajax.dll AjaxPro.JSON.dll AjaxPro.JSON.2.dll
Asp.net AjaxPro实现
AjaxPro.2学习很不错的源码,不明白AjaxPro.2的可以看哈,我自己也不懂,不过慢慢研究后收获不小...
asp.net ajaxPro 源码实例
vs 2005 ajaxpro 2.0 内附简单实用说明
Asp.Net AjaxPro 实例集合
asp.net ajax框架 ajaxpro源代码。 ajaxpro 具有简单的可操作性,无刷新的后台交互,良好的数据封装
AjaxPro.2.dll,AjaxPro.2简单易懂例子 前台利用js调用后台方法