文档库

最新最全的文档下载
当前位置:文档库 > 直接复制粘贴实现gridview上一页下一页首页尾页跳转到指定页

直接复制粘贴实现gridview上一页下一页首页尾页跳转到指定页

Gridview 自动分页后显示上一页下一页首页尾页跳转到指定页功能

首先需要开启分页功能allowpaging=true

然后把

加到aspx页里

之后把这几个函数加到.cs页里

protected void PageButtonClick(object sender, EventArgs e)

{

LinkButton clickedButton = ((LinkButton)sender);

if (http://www.wendangku.net/doc/e9884c6ca45177232f60a2ac.html mandName == "first")

{

this.GridView1.PageIndex = 0;

GridView1.PageIndex = 0;

}

else if (http://www.wendangku.net/doc/e9884c6ca45177232f60a2ac.html mandName == "next")

{

if (GridView1.PageIndex < GridView1.PageCount - 1)

{

GridView1.PageIndex += 1;

GridView1.PageIndex = GridView1.PageIndex;

}

}

else if (http://www.wendangku.net/doc/e9884c6ca45177232f60a2ac.html mandName == "previous")

{

if (GridView1.PageIndex >= 1)

{

GridView1.PageIndex -= 1;

GridView1.PageIndex = GridView1.PageIndex;

}

}

else if (http://www.wendangku.net/doc/e9884c6ca45177232f60a2ac.html mandName == "last")