同桌上课用手指进去了好爽_欧美丰满熟妇xxⅹⅹ性大i_成人av天天日天天拍拍_猛男gay帅男gay男男同志_欧美va天堂在线观看_人妻无码av中文系列三里桃花_亚欧免费无码在线观看_久久久精品国产亚洲av水_日韩在线免费看污污污_2021无码专区人妻系列日韩

首頁 優(yōu)化推廣 分頁控件AspNetPager使用詳解

分頁控件AspNetPager使用詳解

來源: | 時(shí)間:2011/5/5 11:08:50 |

1,引用AspNetPager.dll
2,<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>

.aspx頁面使用:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="fenyeok.aspx.cs" Inherits="fenyeok" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>分頁模板頁,以后就用這個(gè)</title>
<style type="text/css">
   a:Link{
   font-size: 12px;
   color: #3366cc;
   text-decoration: none;
   }
a:visited {
font-size: 12px;
color: #3366cc;
text-decoration: none;

}
.submitBtn {
background-image: url(submitfy.jpg);
font-size:12px;
height: 19px;
width: 37px;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
border-top-width: 0px;
border-right-width: 0px;
border-bottom-width: 0px;
border-left-width: 0px;
}

</style>
</head>
<body style="font-size:12px;">
    <form id="form1" runat="server">
    <div>
    分頁模板頁,以后就用這個(gè),樣式設(shè)置好
        <br />
        <br />
   
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Height="139px" Width="418px">
            <Columns>
                <asp:BoundField DataField="GoodID" HeaderText="GoodID" />
                <asp:BoundField DataField="GoodName" HeaderText="GoodName" />
                <asp:BoundField DataField="father" HeaderText="father" />
            </Columns>
        </asp:GridView>    <br />
        <webdiyer:AspNetPager ID="AspNetPager1" runat="server" PageSize="5" HorizontalAlign="Center" OnPageChanged="AspNetPager1_PageChanged"
                        ShowCustomInfoSection="Left" Width="95%" meta:resourceKey="AspNetPager1" Style="font-size: 12px"
                         CustomInfoHTML="共<b><font color= red >%RecordCount%</font></b>條記錄 當(dāng)前頁:<font color= red ><b>%CurrentPageIndex%/%PageCount%</b></font> 每頁:%PageSize%"
                        AlwaysShow="True" FirstPageText="首頁" LastPageText="尾頁" NextPageText="下一頁" PrevPageText="上一頁" SubmitButtonText="確定"   SubmitButtonClass="submitBtn"
                        CustomInfoStyle="FONT-SIZE: 12px" InputBoxStyle="width:30px; border:1px solid #999999; text-align:center; " TextBeforeInputBox="轉(zhuǎn)到第" TextAfterInputBox="頁 " >
                    </webdiyer:AspNetPager>

    </div>
    </form>
</body>
</html>

 

.aspx.cs 代碼:

using Maticsoft.DBUtility;

protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            ListBind();

        }

    }

    private void ListBind()
    {
        string sqlstr = "select * from testgood ";
        DataSet ds = DbHelperSQL.Query(sqlstr);
        this.AspNetPager1.RecordCount = ds.Tables[0].Rows.Count;

        //.net的自定義分頁
        PagedDataSource pds = new PagedDataSource();
        pds.AllowPaging = true;
        pds.PageSize = AspNetPager1.PageSize;
        pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
        pds.DataSource = ds.Tables[0].DefaultView;
        GridView1.DataSource = pds;
        GridView1.DataBind();


    }

    protected void AspNetPager1_PageChanged(object sender, EventArgs e)
    {
        ListBind();
    }

 

AspNetPager的屬性設(shè)置:

<webdiyer:AspNetPager ID="AspNetPager1" runat="server" Width="100%" NumericButtonCount="6" UrlPaging="true" NumericButtonTextFormatString="[{0}]" CustomInfoHTML=" <font color= red ><b>%CurrentPageIndex%</b></font> %PageCount% 顯示 %StartRecordIndex%-%EndRecordIndex% " ShowCustomInfoSection="left"

FirstPageText="首頁

TAG:高端網(wǎng)站建設(shè)高端網(wǎng)站設(shè)計(jì)網(wǎng)站制作網(wǎng)站建設(shè)

服務(wù)熱線

153 8323 9821

功能和特性

價(jià)格和優(yōu)惠

網(wǎng)站和維護(hù)

推廣和優(yōu)化

微信服務(wù)號(hào)