ie421.NET

面对技术,你别无选择,.NET世界是如此精彩,而我们要做的就是:Thinking More

博客园 首页 新随笔 联系 订阅 管理

=======================================================

 

function JumpPageClient(page)
        
{
            
var label=document.getElementById("memberList");
            
var data=AjaxPager.GetDataTable(parseInt(page),parseInt(pageSize)).value; 

            
//接收服务器端返回的DataTable
            if(data!=null)
            
{
            alert(data.Rows.length);
            }

            label.innerHTML
=data.Rows.length;
            
        }


=========================================================

官方调用方法:

------------------------------------------------------------

调用服务器端方法:

 

function doTest1() {
  AJAXDemo.Examples.DataSets.Demo.GetDataSet(_callback1); 
//不带数调用方式
}




function doTest3() {
  
var ds = AJAXDemo.Examples.DataSets.Demo.GetDataSet().value; // sync invoke of GetDataSet
  AJAXDemo.Examples.DataSets.Demo.GetXmlFromDataSet(ds, _callback2); 

  
//带参数的调用方式,GetXmlFromDataSet(DataSet ds)服务器方法接收一个DataSet方法,并返回xml
}


-----------------------------------------------------------

接收服务器返回的数据,并操作DOM:


 

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");
}

function _callback2(res) {
 alert(res.value);
}


==========================================================

 

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");
    
dt.addRow(
{"FirstName":"Michael","Age":28});
dt.addRow(
{"FirstName":"Tanja","Age":25});
    
ds.addTable(dt);

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:

 

dt.addRow({"FirstName":"Michael","Age":28});

// or using an object

var row = new Object();

row.FirstName 
= "Michael";
row.Age 
= 28;

dt.addRow(row);
posted on 2008-07-27 12:37  ie421  阅读(280)  评论(0编辑  收藏  举报