佳木斯湛栽影视文化发展公司

主頁 > 知識庫 > GridView分頁代碼簡單萬能實用

GridView分頁代碼簡單萬能實用

熱門標簽:服務器配置 團購網(wǎng)站 阿里云 銀行業(yè)務 電子圍欄 科大訊飛語音識別系統(tǒng) Mysql連接數(shù)設置 Linux服務器
復制代碼 代碼如下:

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實現(xiàn)分頁的實例代碼
  • asp.net中gridview的查詢、分頁、編輯更新、刪除的實例代碼
  • GridView高效分頁和搜索功能的實現(xiàn)代碼
  • .net GridView分頁模板的實例代碼
  • asp.net中讓Repeater和GridView支持DataPager分頁
  • jquery+ashx無刷新GridView數(shù)據(jù)顯示插件(實現(xiàn)分頁、排序、過濾功能)
  • 利用jQuery 實現(xiàn)GridView異步排序、分頁的代碼
  • GridView自定義分頁的四種存儲過程
  • ASP.Net2.0 GridView 多列排序,顯示排序圖標,分頁
  • GridView分頁的實現(xiàn)(通用分頁模板)

標簽:廣元 大理 萍鄉(xiāng) 衢州 江蘇 蚌埠 棗莊 衡水

巨人網(wǎng)絡通訊聲明:本文標題《GridView分頁代碼簡單萬能實用》,本文關鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權問題,煩請?zhí)峁┫嚓P信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡,涉及言論、版權與本站無關。
  • 相關文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    贵阳市| 天镇县| 麻阳| 福鼎市| 县级市| 贵德县| 蓬安县| 张北县| 玉溪市| 金华市| 饶河县| 武山县| 七台河市| 梁河县| 庆安县| 渑池县| 廉江市| 美姑县| 黄大仙区| 东港市| 明溪县| 方正县| 福建省| 南溪县| 柳林县| 北票市| 涞水县| 东方市| 潢川县| 大化| 万源市| 萝北县| 定西市| 茌平县| 海原县| 万州区| 前郭尔| 上高县| 哈巴河县| 沁阳市| 社旗县|