RSS
热门关键字:  Linux  项目管理  图形  LAMP  java
当前位置 : 主页>开源技术>AJAX技术>列表

利用Ajax实现DataGrid无刷新分页(AjaxGrid)

来源:中国开源社区 作者:sherman 时间:2007-09-18 点击:

利用Ajax实现DataGrid无刷新分页(AjaxGrid)

中国开源社区

中国开源社区

DataGrid功能强大,我们只用写几行代码就能够实现复杂的页面数据显示。数据多的时候免不了要分页显示,DataGrdi本身自带分页功能,但是当数据量少的时候很方便,当大数据量时,DataGrid得分页机制就不太好了。于是在网上找到了一种比较好的利用存储过程实现分页机制(客户端想要第几页就取第几页数据,上十万级的数据查询也很快,数据量再多的时候就没试过了,等有时间把利用存储过程分页也写在blog上)在工作中为了让客户用的更舒服点,也赶时髦,想利用Ajax来实现DataGrid无刷新分页。主要用RenderControl方法把DataGrid翻译成Html代码,然后用Web Service 返回。当然也可以用别的方法。 中国开源社区

GenericAjaxWS.asmx.cs

中国开源社区

using System; www.ossforge.com

using System.Collections; 中国开源社区

using System.ComponentModel;

中国开源社区

using System.Data; 中国开源社区

using System.Data.SqlClient;

中国开源社区

using System.Diagnostics; www.ossforge.com

using System.Web; www.ossforge.com

using System.Web.Services; 中国开源社区

using System.Configuration; www.ossforge.com

using System.Web.UI.WebControls;

www.ossforge.com

using System.Web.UI;

www.ossforge.com

using System.IO; www.ossforge.com

namespace GenricAjaxWS

中国开源社区

{

中国开源社区

[WebService(Namespace="http://localhost/GenricAjaxWS/")]

www.ossforge.com

public class GenricAjaxWS : System.Web.Services.WebService

www.ossforge.com

{

中国开源社区

SqlConnection con; www.ossforge.com

SqlDataAdapter da; www.ossforge.com

SqlCommand cmd;

中国开源社区

DataSet ds;

www.ossforge.com

public GenricAjaxWS()

www.ossforge.com

{ www.ossforge.com

InitializeComponent(); 中国开源社区

con= new SqlConnection(ConfigurationSettings.AppSettings["Connect"]);

中国开源社区

da=new SqlDataAdapter("",con); 中国开源社区

cmd=new SqlCommand("",con); 中国开源社区

ds=new DataSet("TahaSchema"); 中国开源社区

} 中国开源社区

#region Component Designer generated code

www.ossforge.com

//Required by the Web Services Designer www.ossforge.com

private IContainer components = null;

www.ossforge.com

/// <summary>

www.ossforge.com

/// Required method for Designer support - do not modify www.ossforge.com

/// the contents of this method with the code editor.

最新评论共有 6 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册