日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) >

一个简单的GridView分页

發(fā)布時(shí)間:2025/4/14 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 一个简单的GridView分页 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

在GridView里面加上

<PagerTemplate>
?<asp:LinkButton ID="FirstPage" runat="server" CommandName="Page" CommandArgument="First" Enabled="<%#((GridView)Container.Parent.Parent).PageIndex!=0 %>">首頁(yè)</asp:LinkButton>
???????? <asp:LinkButton ID="PreviewPage" runat="server" CommandArgument="Prev" CommandName="Page" Enabled="<%#((GridView)Container.Parent.Parent).PageIndex!=0 %>">上一頁(yè)</asp:LinkButton>
????????? <asp:LinkButton ID="NextPage" runat="server" CommandName="Page" CommandArgument="Next" Enabled="<%#((GridView)Container.Parent.Parent).PageIndex!=((GridView)Container.Parent.Parent).PageCount-1 %>">
下一頁(yè)</asp:LinkButton>
????????? <asp:LinkButton ID="LastPage" runat="server" CommandName="Page" CommandArgument="Last" Enabled="<%#((GridView)Container.Parent.Parent).PageIndex!=((GridView)Container.Parent.Parent).PageCount-1 %>">尾頁(yè)</asp:LinkButton>第<asp:Label ID="lblcurPage" runat="server" ?Text='<%#((GridView)Container.Parent.Parent).PageIndex+1%>'></asp:Label>頁(yè)/共
<asp:Label ID="lblPageCount" runat="server" Text='<%#((GridView)Container.Parent.Parent).PageCount %>'></asp:Label>頁(yè)
??????? <asp:TextBox ID="txtGo" runat="server" Width="30px" Text='<%#((GridView)Container.Parent.Parent).PageIndex+1 %>'></asp:TextBox>頁(yè)
????????? <asp:Button ID="btnTurn" runat="server" Text="轉(zhuǎn)到" OnClick="btnTurn_Click" />
</PagerTemplate>

編輯模板雙擊Button在后臺(tái)代碼:
??? protected void btnTurn_Click(object sender, EventArgs e)
??? {
??????? GrvInquires.PageIndex = int.Parse(((TextBox)GrvInquires.BottomPagerRow.FindControl("txtGo")).Text) - 1;
??????? MyDataBind();
??? }

轉(zhuǎn)載于:https://www.cnblogs.com/gjwolf/archive/2012/04/27/2473630.html

總結(jié)

以上是生活随笔為你收集整理的一个简单的GridView分页的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。