求一个ajax无刷新的分页控件在线等!!!!

aziax 2007-04-21 04:24:09
求一个ajax无刷新的分页控件在线等!!!!
发邮箱也可以 aziax@163.com 马上给分
...全文
272 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
happyf101 2007-04-22
  • 打赏
  • 举报
回复
我顶 顶顶顶顶
ron8291 2007-04-21
  • 打赏
  • 举报
回复
顶,用直接用datagrid回传的传什么呢?
绝代坏坏 2007-04-21
  • 打赏
  • 举报
回复
ajax1.0+gridview就ok
ltmltm123456 2007-04-21
  • 打赏
  • 举报
回复
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
using System.Configuration;
using System.Web.UI.WebControls;
using System.Web.UI;
using System.IO;

namespace GenricAjaxWS
{
[WebService(Namespace="http://localhost/GenricAjaxWS/")]
public class GenricAjaxWS : System.Web.Services.WebService
{
SqlConnection con;
SqlDataAdapter da;
SqlCommand cmd;
DataSet ds;

public GenricAjaxWS()
{
InitializeComponent();
con= new SqlConnection(ConfigurationSettings.AppSettings["Connect"]);
da=new SqlDataAdapter("",con);
cmd=new SqlCommand("",con);
ds=new DataSet("TahaSchema");
}

#region Component Designer generated code

//Required by the Web Services Designer
private IContainer components = null;

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if(disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}

#endregion

/// <summary>
/// this function accepts TSql statment and returns dataset
/// </summary>


[WebMethod]
public string getGrid(string sqlStr,int pageIndex)
{
da.SelectCommand.CommandText=sqlStr;
da=new SqlDataAdapter(sqlStr,con);
da.Fill(ds,"myTable");

DataGrid dataGrid = new DataGrid();
dataGrid.AutoGenerateColumns = true;
dataGrid.DataSource = ds.Tables["myTable"].DefaultView;
dataGrid.AllowPaging = true;
dataGrid.PageSize = 4;
dataGrid.PagerStyle.Visible = false;
dataGrid.CurrentPageIndex = pageIndex;
try
{
dataGrid.DataBind();
}
catch(Exception)
{

}
StringWriter wr = new StringWriter();
HtmlTextWriter writer = new HtmlTextWriter(wr);
dataGrid.RenderControl(writer);
string gridHtml = wr.ToString();
wr.Close();
writer.Close();
DropDownList ddl_Pager = new DropDownList();
ddl_Pager.Attributes.Add("onchange","goToPage(this.value)");
string pager="";
for(int i=0;i<dataGrid.PageCount;i++)
{
ListItem lItem = new ListItem(i.ToString(),i.ToString());
ddl_Pager.Items.Add(lItem);
if(i==pageIndex)
{
pager += "[background-color:#ffdd11;width" +
":20px;align:center\"><a href=\"#\" onclick" +
"=\"goToPage('"+i+"')\">"+i+"</a>]";
}
else
{
pager += "[width:20px;align:center\">" +
"<a href=\"#\" onclick=\"goToPage" +
"('"+i+"')\" >"+i+"</a>]";
}
}
ddl_Pager.SelectedIndex = pageIndex;
wr = new StringWriter();
writer = new HtmlTextWriter(wr);
ddl_Pager.RenderControl(writer);
string pagerHtml = "<input type='button'" +
" value='<' onclick='goToPrevPage()'>";
pagerHtml += wr.ToString();
pagerHtml += "<input type='button' value='>'" +
" onclick='this.disabled=goToNextPage()'>";
wr.Close();
writer.Close();
return pager+pagerHtml+"<br>"+gridHtml;
}
}
}

liu_87663663 2007-04-21
  • 打赏
  • 举报
回复
http://blog.csdn.net/soarheaven/archive/2006/09/24/1270120.aspx
liu_87663663 2007-04-21
  • 打赏
  • 举报
回复
到网上可下载可
zhulei2008 2007-04-21
  • 打赏
  • 举报
回复
帮顶

62,047

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧