<script type="text/javascript">
</script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
从http://Ajax.NET/下载一个压缩包,解开过后有一个txt的quick usage guide和一个DOC的Ajax .NET Wrapper usage guide以及一个DLL。
嗯,看看TXT的先。了解到Ajax开发的大概步骤:
一、项目中建立一个引用,把Ajax.dll引用进来。
二、修改web.config文件,加入
<httpHandlers>
<add verb="POST,GET" path="Ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax" />
</httpHandlers>
三、在页面的page_load事件中添加如下代码:
Ajax.Utility.RegisterTypeForAjax(typeof(WebForm1));
到这儿,页面就可以使用Ajax了。
可以在后台代码中写一个函数,在客户端进行调用。比如:
[Ajax.AjaxMethod()]
public int ServerSideAdd(int firstNumber, int secondNumber)
{
return firstNumber + secondNumber;
}
这儿[Ajax.AjaxMethod()]这句是一定要加的。不然在客户端没有办法使用。
这样,在客户端就可以直接使用这个ServerSideAdd方法了。比如:
function add2()
{
var re=WebForm1.ServerSideAdd(Form1.first.value,Form1.second.value )
Form1.result.value =re.value;
}
大家可以看到在JS中,这个服务端的方法前还跟了一个WebForm1,这是页面对应的类名。
TXT文件中的例子只是让大家初步了解一下Ajax的一些作用,当然还有更强大的啦。作为客户端使用的方法,返回值不只可以是普通的如int、string这样的类型,还可以返回如DataSet和class这样的复杂类型,这也为客户端的“强javascript”提供了可能,让开发人员在界面上就可以进行“面向对象”的开发。
同时,Ajax中的无刷新也是它的亮点之一。有名的组件ComponentArt新出的3。0产品,就有Call-back组件,大家有兴趣的话可以试试。
当然微软也有Ajax产品:Atlas
详细的情况可以参考:
ASP.NET "Atlas" Preview Documentation <script type="text/javascript"> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript">
</script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
Ajax不能不说是一种很好的技术。刚下了一个Ajax.NET,来试试。 从http://Ajax.NET/下载一个压缩包,解开过后有一个txt的quick usage guide和一个DOC的Ajax .NET Wrapper usage guide以及一个DLL。
嗯,看看TXT的先。了解到Ajax开发的大概步骤:
一、项目中建立一个引用,把Ajax.dll引用进来。
二、修改web.config文件,加入
<httpHandlers>
<add verb="POST,GET" path="Ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax" />
</httpHandlers>
三、在页面的page_load事件中添加如下代码:
Ajax.Utility.RegisterTypeForAjax(typeof(WebForm1));
到这儿,页面就可以使用Ajax了。
可以在后台代码中写一个函数,在客户端进行调用。比如:
[Ajax.AjaxMethod()]
public int ServerSideAdd(int firstNumber, int secondNumber)
{
return firstNumber + secondNumber;
}
这儿[Ajax.AjaxMethod()]这句是一定要加的。不然在客户端没有办法使用。
这样,在客户端就可以直接使用这个ServerSideAdd方法了。比如:
function add2()
{
var re=WebForm1.ServerSideAdd(Form1.first.value,Form1.second.value )
Form1.result.value =re.value;
}
大家可以看到在JS中,这个服务端的方法前还跟了一个WebForm1,这是页面对应的类名。
TXT文件中的例子只是让大家初步了解一下Ajax的一些作用,当然还有更强大的啦。作为客户端使用的方法,返回值不只可以是普通的如int、string这样的类型,还可以返回如DataSet和class这样的复杂类型,这也为客户端的“强javascript”提供了可能,让开发人员在界面上就可以进行“面向对象”的开发。
同时,Ajax中的无刷新也是它的亮点之一。有名的组件ComponentArt新出的3。0产品,就有Call-back组件,大家有兴趣的话可以试试。
当然微软也有Ajax产品:Atlas
详细的情况可以参考:
ASP.NET "Atlas" Preview Documentation <script type="text/javascript"> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript">
</script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>