GridView分頁代碼簡單萬能實(shí)用
<asp:GridView ID="GridViewHistory" runat="server" AutoGenerateColumns="False"
CssClass="vip_table" GridLines="None" BorderStyle="None" CellPadding="0"
ShowHeader="False" AllowPaging="true" PageSize="20"
onpageindexchanging="GridViewHistory_PageIndexChanging">
<PagerTemplate>
<asp:LinkButton ID="lb_firstpage" runat="server" onclick="lb_firstpage_Click">首頁</asp:LinkButton>
<asp:LinkButton ID="lb_previouspage" runat="server"
onclick="lb_previouspage_Click">上一頁</asp:LinkButton>
<asp:LinkButton ID="lb_nextpage" runat="server" onclick="lb_nextpage_Click">下一頁</asp:LinkButton>
<asp:LinkButton ID="lb_lastpage" runat="server" onclick="lb_lastpage_Click">尾頁</asp:LinkButton>
第<asp:Label ID="lbl_nowpage" runat="server" Text="<%#GridViewHistory.PageIndex+1 %>" ForeColor="#db530f"></asp:Label>頁/共<asp:Label
ID="lbl_totalpage" runat="server" Text="<%#GridViewHistory.PageCount %>" ForeColor="#db530f"></asp:Label>頁
</PagerTemplate>

后臺代碼:
//分頁
protected void GridViewHistory_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridViewHistory.PageIndex = e.NewPageIndex;
dataBinding();
}
protected void Button_search_Click(object sender, EventArgs e)
{
dataBinding();
}
protected void lb_firstpage_Click(object sender, EventArgs e)
{
this.GridViewHistory.PageIndex = 0;
dataBinding();
}
protected void lb_previouspage_Click(object sender, EventArgs e)
{
if (this.GridViewHistory.PageIndex > 0)
{
this.GridViewHistory.PageIndex--;
dataBinding();
}
}
protected void lb_nextpage_Click(object sender, EventArgs e)
{
if (this.GridViewHistory.PageIndex < this.GridViewHistory.PageCount)
{
this.GridViewHistory.PageIndex++;
dataBinding();
}
}
protected void lb_lastpage_Click(object sender, EventArgs e)
{
this.GridViewHistory.PageIndex = this.GridViewHistory.PageCount;
dataBinding();
}
dataBinding()為GridViewHistory的數(shù)據(jù)源綁定事件
- AspNetPager+GridView實(shí)現(xiàn)分頁的實(shí)例代碼
- asp.net中g(shù)ridview的查詢、分頁、編輯更新、刪除的實(shí)例代碼
- GridView高效分頁和搜索功能的實(shí)現(xiàn)代碼
- .net GridView分頁模板的實(shí)例代碼
- asp.net中讓Repeater和GridView支持DataPager分頁
- jquery+ashx無刷新GridView數(shù)據(jù)顯示插件(實(shí)現(xiàn)分頁、排序、過濾功能)
- 利用jQuery 實(shí)現(xiàn)GridView異步排序、分頁的代碼
- GridView自定義分頁的四種存儲過程
- ASP.Net2.0 GridView 多列排序,顯示排序圖標(biāo),分頁
- GridView分頁的實(shí)現(xiàn)(通用分頁模板)
相關(guān)文章
ASP.NET Core環(huán)境變量和啟動設(shè)置的配置教程
這篇文章主要為大家詳細(xì)介紹了ASP.NET Core環(huán)境變量和啟動設(shè)置的配置教程,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-07-07vb 中的MD5加密在asp.net中的實(shí)現(xiàn)
給定標(biāo)識哈希類型的密碼和字符串,該例程產(chǎn)生一個(gè)適合存儲在配置文件中的哈希密碼,感興趣的朋友可以參考下本文2013-04-04使用HtmlAgilityPack XPath 表達(dá)式抓取博客園數(shù)據(jù)的實(shí)現(xiàn)代碼
使用HtmlAgilityPack XPath表達(dá)式來抓取博客園數(shù)據(jù)使用WebClient 下載數(shù)據(jù),HtmlAgilityPack XPath表達(dá)式解析數(shù)據(jù),并綁定到Repeater控件2011-12-12asp.net Page.EnableEventValidation 屬性驗(yàn)證服務(wù)器控件的回發(fā)和回調(diào)事件出現(xiàn)的錯誤
Page.EnableEventValidation 屬性驗(yàn)證服務(wù)器控件的回發(fā)和回調(diào)事件出現(xiàn)的錯誤前兩天用jQuery做了一個(gè)包含DropDownList聯(lián)動的頁面,數(shù)據(jù)通過Ajax請求得到的。2010-10-10ajaxpro.dll 控件實(shí)現(xiàn)異步刷新頁面
用ajaxpro.dll控件實(shí)現(xiàn)異步刷新頁面的代碼,需要的朋友可以參考下。2009-11-11Asp.net中的數(shù)據(jù)綁定Eval和Bind應(yīng)用示例
這篇文章主要介紹了Asp.net中的數(shù)據(jù)綁定Eval和Bind的應(yīng)用,需要的朋友可以參考下2014-05-05asp.net c# 調(diào)用百度pai實(shí)現(xiàn)在線翻譯,英文轉(zhuǎn)中文
本文詳細(xì)介紹asp.net c# 調(diào)用百度pai 實(shí)現(xiàn)在線翻譯以及英文轉(zhuǎn)中文實(shí)現(xiàn)代碼,需要了解的朋友可以參考下2012-12-12Entity?Framework?Core相關(guān)包的概念介紹與安裝
這篇文章介紹了Entity?Framework?Core相關(guān)包的概念與安裝方法,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2022-03-03