今天整了半天才把DataList的分頁搞定
前台代碼
<div id=
<asp:DataList ID=
<HeaderTemplate>
<div>
<img src=
</HeaderTemplate>
<ItemTemplate>
<dl>
<dd>
·<a #
<%#Eval(
</dd>
</dl>
</ItemTemplate>
</asp:DataList>
</div>
<div align=
<webdiyer:AspNetPager ID=
LastPageText=
PrevPageText=
</webdiyer:AspNetPager>
</div>
後台代碼
protected void Page_Load(object sender
{
if (!IsPostBack)
{
BindNewsDatalist();
}
}
//綁定DataList的數據源
private void BindNewsDatalist()
{
FJDWS
this
PagedDataSource pds = new PagedDataSource(); //定義一個PagedDataSource類來執行分頁功能
pds
pds
pds
pds
this
NewsList
}
protected void AspNetPager
{
//AspNetPager
BindNewsDatalist();
}
From:http://tw.wingwit.com/Article/program/net/201311/12232.html