GridView分页问题?
<PagerTemplate>
<asp:LinkButton ID="lbFirst" runat="server" CausesValidation="False" CommandArgument="First"
CommandName="Page">首页</asp:LinkButton>
<asp:LinkButton ID="lbPrev" runat="server" CausesValidation="False" CommandArgument="Prev"
CommandName="Page">上一页</asp:LinkButton>
<asp:LinkButton ID="lbNext" runat="server" CausesValidation="False" CommandArgument="Next"
CommandName="Page">下一页</asp:LinkButton>
<asp:LinkButton ID="lbLast" runat="server" CausesValidation="False" CommandArgument="Last"
CommandName="Page">尾页</asp:LinkButton> 第<asp:Label ID="Label2"
runat="server" Text="<%#((GridView)Container.Parent.Parent).PageIndex + 1 %>"></asp:Label>页
共<asp:Label ID="Label1" runat="server" Text="<%# ((GridView)Container.Parent.Parent).PageCount %>"></asp:Label>页
跳到<asp:TextBox ID="tbPage" runat="server" Text="<%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>"
Width="27px"></asp:TextBox>
<asp:LinkButton ID="lbGO" runat="server" CausesValidation="False" CommandArgument="-1"
CommandName="Page" Text="GO"></asp:LinkButton>
</PagerTemplate>
分页事件
protected void borrowGridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView gvw = (GridView)sender;
if (e.NewPageIndex < 0)
{
TextBox pageNum = (TextBox)gvw.BottomPagerRow.FindControl("tbpage");
int Pa = int.Parse(pageNum.Text);
if (Pa <= 0)
gvw.PageIndex = 0;
else
gvw.PageIndex = Pa - 1;
}
else
{
gvw.PageIndex = e.NewPageIndex;
}
borrowGridView.DataSource = sa.selAssertBorrow();
borrowGridView.DataBind();
}
首页 上一页 下一页 尾页 第?页 共?页 跳到?页GO
帮忙修改一下代码,要实现在第一页的时候"首页"和"上一页"不可用,在最后一页的时候"尾页"和"下一页"不可用,点GO的时候不能跳到要指定到的页。 谢谢拉!