日期:2014-05-18  浏览次数:20446 次

发我个ajaxpro的简单实例
我使用c#2003,引用ajaxpro.dll,作个简单的实例,网页状态栏老报网页有错,那位发我个2003的实例,我比较一下哪里错了。nbqxb@126.com     谢谢了

------解决方案--------------------
在2005里是这样实现的
在web.config里注册
在.cs文件里的page_load里写
AjaxPro.Utility.RegisterTypeForAjax(typeof(_Default));类型写页面所在的类
然都定义一个函数
[AjaxPro.AjaxMethod]
public void a()
{}
最后在前台 _Default.a()就可以了
------解决方案--------------------
1、下载ajaxpro.dll,并将其dll引用到项目中。

2、在webconfig的 <system.web>下加上
<httpHandlers>
<add verb="POST,GET" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro"/>
</httpHandlers>

3、在Page_Load中添加事件
private void Page_Load(object sender, System.EventArgs e)
{
AjaxPro.Utility.RegisterTypeForAjax(typeof(WebApplication1.WebForm1));
}

4、我们可以在服务器端的CS文件中写下函数,如:
[AjaxMethod]
public static string gettext(string str)
{
return str;
}

但是要说明的是,每个ajax函数定义前必须加上[AjaxMethod]。

5、调用的时候就可以用以下方式进行
<script>
function test()
{
alert(WebApplication1.WebForm1.gettext('ajax_Test').value);
}
</script>

WebApplication1.WebForm1当前窗体,gettext()是我们在cs文件中写的函数。