=======================================================
function JumpPageClient(page)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
{
var label=document.getElementById("memberList");
var data=AjaxPager.GetDataTable(parseInt(page),parseInt(pageSize)).value;
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
//接收服务器端返回的DataTable
if(data!=null)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
alert(data.Rows.length);
}
label.innerHTML=data.Rows.length;
}
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
=========================================================
官方调用方法:
------------------------------------------------------------
调用服务器端方法:
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
function doTest1()
{
AJAXDemo.Examples.DataSets.Demo.GetDataSet(_callback1); //不带数调用方式
}
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
function doTest3()
{
var ds = AJAXDemo.Examples.DataSets.Demo.GetDataSet().value; // sync invoke of GetDataSet
AJAXDemo.Examples.DataSets.Demo.GetXmlFromDataSet(ds, _callback2);
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
//带参数的调用方式,GetXmlFromDataSet(DataSet ds)服务器方法接收一个DataSet方法,并返回xml
}
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
-----------------------------------------------------------
接收服务器返回的数据,并操作DOM:
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
function _callback1(res)
{
var cols = res.value.Tables[0].Columns.length;
var rows = res.value.Tables[0].Rows.length;
alert(cols + " cols and " + rows + " rows");
}
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
function _callback2(res)
{
alert(res.value);
}
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
==========================================================
Creating a DataSet on the client-side JavaScript
With the new version you can create a DataSet directly on the client-side JavaScript code. You may use this objects to save cart items or if you have other items that can be saved in tables. See following JavaScript code that will create a DataSet:
var ds = new Ajax.Web.DataSet();
var dt = new Ajax.Web.DataTable();
dt.addColumn("FirstName", "System.String");
dt.addColumn("Age", "System.Int32");
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
dt.addRow(
{"FirstName":"Michael","Age":28});
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
dt.addRow(
{"FirstName":"Tanja","Age":25});
ds.addTable(dt);
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
In this short example I configure two columns, the first one will hold a string, and the second column Age will use a integer. Now, we can add rows to the DataTable dt. There are two ways to add a new row:
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
dt.addRow(
{"FirstName":"Michael","Age":28});
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
// or using an object
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
var row = new Object();
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
row.FirstName = "Michael";
row.Age = 28;
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
dt.addRow(row);
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)