首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

gridview手动分页例子,该怎么解决

2012-02-05 
gridview手动分页例子自动分页效率低,哪为朋友给个手动分页的例子或者控件呢要求显示:当前页共**页面首页

gridview手动分页例子
自动分页效率低,哪为朋友给个手动分页的例子或者控件呢
要求显示:当前页   共**页面   首页   上   下   尾页   跳转到


[解决办法]
控制好数据集的大小会更方便一些
[解决办法]
//分页开始
objpage = new PagedDataSource();
DataView dv = ds.Tables[0].DefaultView;

objpage.DataSource = dv;
dv.Sort = "State,PlanID desc ";
objpage.AllowPaging = true;
objpage.PageSize = 8;
int curpage = 0;
if (Request.QueryString[ "Page "] != null)
curpage = Convert.ToInt32(Request.QueryString[ "Page "]);
else
curpage = 1;
objpage.CurrentPageIndex = curpage - 1;
try
{
if (objpage.IsFirstPage && !objpage.IsLastPage)
{
this.hlProv.NavigateUrl = " ";
this.hlFirst.NavigateUrl = " ";
this.hlProv.ForeColor = System.Drawing.Color.Black;
this.hlFirst.ForeColor = System.Drawing.Color.Black;
this.hlNext.NavigateUrl = url + "?page= " + Convert.ToInt32(curpage + 1) + "&shopID= " + shopID;
this.hlLast.NavigateUrl = url + "?page= " + Convert.ToInt32(objpage.PageCount) + "&shopID= " + shopID;
}
else
{
if (objpage.IsLastPage && !objpage.IsFirstPage)
{
this.hlFirst.NavigateUrl = url + "?page= " + 1 + "&shopID= " + shopID;
this.hlLast.NavigateUrl = " ";
this.hlNext.NavigateUrl = " ";
this.hlLast.ForeColor = System.Drawing.Color.Black;
this.hlNext.ForeColor = System.Drawing.Color.Black;
this.hlProv.NavigateUrl = url + "?page= " + Convert.ToInt32(curpage - 1) + "&shopID= " + shopID;
}
else
{
if (objpage.IsFirstPage && objpage.IsLastPage)
{
this.hlLast.NavigateUrl = " ";
this.hlNext.NavigateUrl = " ";
this.hlProv.NavigateUrl = " ";
this.hlFirst.NavigateUrl = " ";
this.hlLast.ForeColor = System.Drawing.Color.Black;
this.hlNext.ForeColor = System.Drawing.Color.Black;
this.hlProv.ForeColor = System.Drawing.Color.Black;
this.hlFirst.ForeColor = System.Drawing.Color.Black;
}
else
{
this.hlFirst.NavigateUrl = url + "?page= " + 1;
this.hlLast.NavigateUrl = url + "?page= " + Convert.ToInt32(objpage.PageCount) + "&shopID= " + shopID;
this.hlNext.NavigateUrl = url + "?page= " + Convert.ToInt32(curpage + 1) + "&shopID= " + shopID;
this.hlProv.NavigateUrl = url + "?page= " + Convert.ToInt32(curpage - 1) + "&shopID= " + shopID;
}


}
}
}
[解决办法]
http://dotnet.aspx.cc/article/b12283de-db20-4322-accc-12724442808a/read.aspx
[解决办法]
手动分页存储过程很多的。
我用的sql2000,所以用的是没公开的那个,就是邹建弄的那个。

外观一直用吴旗娃的。
[解决办法]
试试我写的这个免费分页控件:
http://www.webdiyer.com
[解决办法]
嗯,aspnetpager确实不错

热点排行