文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > IT/计算机 > 计算机软件及应用 > asp net分页功能的实现
侵权投诉

asp net分页功能的实现

非常有用的功能

<PagerTemplate>
<table width="100%">
<tr>
<td style="text-align: right">
第<asp:Label ID="lblPageIndex" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>' />页
共/<asp:Label ID="lblPageCount" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageCount %>' />页
<asp:LinkButton ID="btnFirst" runat="server" CausesValidation="False" CommandArgument="First"
CommandName="Page" Text="首页" />
<asp:LinkButton ID="btnPrev" runat="server" CausesValidation="False" CommandArgument="Prev"
CommandName="Page" Text="上一页" />
<asp:LinkButton ID="btnNext" runat="server" CausesValidation="False" CommandArgument="Next"
CommandName="Page" Text="下一页" />
<asp:LinkButton ID="btnLast" runat="server" CausesValidation="False" CommandArgument="Last"
CommandName="Page" Text="尾页" />
<asp:TextBox ID="txtNewPageIndex" runat="server" Width="20px" Text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>' />
<asp:LinkButton ID="btnGo" runat="server" CausesValidation="False" CommandArgument="-1"
CommandName="Page" Text="GO" />
</td>
</tr>
</table>
</PagerTemplate>




//分页代码
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView theGrid = sender as GridView; // refer to the GridView
int newPageIndex = 0;

if (-2 == e.NewPageIndex)
{ // when click the "GO" Button
TextBox txtNewPageIndex = null;
//GridViewRow pagerRow = theGrid.Controls[0].Controls[theGrid.Controls[0].Controls.Count - 1] as GridViewRow; // refer to PagerTemplate
GridViewRow pagerRow = theGrid.BottomPagerRow; //GridView较DataGrid提供了更多的API,获取分页块可以使用BottomPagerRow 或者TopPagerRow,当然还增加了HeaderRow和FooterRow
//updated at 2006年6月21日3:15:33

if (null != pagerRow)
{
txtNewPageIndex = pagerRow.FindControl("txtNewPageIndex") as TextBox; // refer to the TextBox with the NewPageIndex value
}

if (null != txtNewPageIndex)
{
newPageIndex = int.Parse(txtNewPageIndex.Text) - 1; // get the NewPageIndex
}
}
else
{ // when click the first, last, previous and next Button
newPageIndex = e.NewPageIndex;
}

// check to prevent form the NewPageIndex out of the range
newPageIndex = newPageIndex < 0 ? 0 : newPageIndex;
newPageIndex = newPageIndex >= theGrid.PageCount ? theGrid.PageCount - 1 : newPageIndex;

// specify the NewPageIndex
theGrid.PageIndex = newPageIndex;

第1页

你可能喜欢

热门文档

相关文档

  • ASP分页功能实现方法

    关键词:文献ASPNET分页 1/2 相关文档推荐 ASP中的分页功能实现 暂无评价 6页...如要投诉违规内容,请到百度文库投诉中心;如要提出功能问题或意见建议,请点击此处...

  • ASP_NET中实现数据分页的几种方法

    该文讨论了在 ASP.NET 框架下对 WEB 数据库几种实现分页 显示的方法。 对利用自带分页功能的数据控件(如:DataGrid )和对于没有自带分页功能的控件(如:DataList...

  • .NET4.0 实现分页效果

    .NET4.0 实现分页效果_计算机软件及应用_IT/计算机_专业资料。ASP.NET4.0 实现分页效果 在 ASP.NET 中,用户不仅可以通过分页控件,来显示数据库内容。用户还可以...

  • ASP_NET中大数据量分页技术的研究与实现

    中大数据量分页技术的研究与实现陈 南( 同济大学电子与信息工程学院 上海 201804) 摘 在用 ASP. NET 开发 Web 数据库查询功能模块时, 经常会碰到数据量比较大...

  • ASP中实现分页显示的七种武器

    ASP中实现分页显示的七种武器_建筑/土木_工程科技_专业资料。ASP中实现分页显示的...ASP Access实现增删改查... 4页 免费 asp net分页功能的实现 2页 免费 长文...

  • ASP.NET技巧:access下的分页方案

    ASP. NET 中数据分页技术... 3页 2下载券 asp net分页功能的实现 2页 免费...access下的分页方案(仿sql存储过程) /// 作者:cncxz(虫虫) /// blog:http:...

  • 在ASP.NET中实现高效灵活的自定义分页

    如要投诉违规内容,请到百度文库投诉中心;如要提出功能问题或意见建议,请点击此处进行反馈。 加入会员!获取文档下载券 在ASP.NET中实现高效灵活的自定义分页 本文...

  • ASP.NET中大数据量分页技术的研究与实现

    如要投诉违规内容,请到百度文库投诉中心;如要提出功能问题或意见建议,请点击此处进行反馈。 加入会员!获取文档下载券 ASP.NET中大数据量分页技术的研究与实现 在用...

  • asp分页控件实例超详细简单

    由于项目开发中需要用到分页的功能,所以自己就研究并写了一个 asp.net 分页控件, 其中的实现全部是个人理解并进行编写的代码, 而且我也写了一个事例供大家参考 (...

  • ASP. NET 中数据分页技术的研究

    1. 1 使用 DataGrid 控件分页显示数据 DataGrid 控件是 ASP. NET 中功能最...本文定义了一个 DataPager 的自定义控件.由于自定 义控 件的实现代码比较多, ...

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email