About me

Calendar

Search

Recent Articles

Recent Comments

Links

Statistics

Support


Except where otherwise noted, this site is licensed under a Creative Commons License.
除特别说明,本站所有内容都遵循创作共用协议.

About ADS

 

 
给我留言My Guestbook  我的照片My Photo  友情提示您,当前时间为:

如何使用PagedDataSource來做DataRepeater的分頁的效果

[ 2006/4/22 16:10:00 | ]


ASP.NET中的DataList和DataRepeater提供了簡單快速的方法來展現資料,
更是讓我們能隨心所欲的決定資料的排放方式.可惜的是他
們不像Datagrid那樣,有內建的分頁功能.

如何解決這個不能分頁的問題呢?在這篇文章中將會介紹如何使用 PagedDataSource Class 來解決分頁的問題.

簡單的介紹幾個常用到的 PagedDataSource Class Public Properties

DataSource - 資料來源
AllowPaging - true 允許分頁;false 不允許.
PageSize - 決定重複多少次
PageCount - 總共有幾頁
CurrentPageIndex - 目前所在的頁數
IsFirstPage - 是第一頁嗎,回傳True or False
IsLastPage - 是最後一頁嗎,回傳True or False

下面就是範例(剪貼就可以直接跑了)

--------------------------------------------------------------------------------

<%@ Page Language="VB" %>
<%@ import Namespace="System.Data" %>



DataRepeater Paging Example







<< Prev
Next >>

of











Order Date: <%# DataBinder.Eval(Container.DataItem, "DateTimeValue", "{0:d}") %>

Quantity: <%# DataBinder.Eval(Container.DataItem, "IntegerValue", "{0:N2}") %>

Item: <%# DataBinder.Eval(Container.DataItem, "StringValue") %>

Order Date: '' runat="server"/>







Datasource:Microsoft QuickStart Example

http://cht.gotdotnet.com/quickstart/aspplus/doc/webdatabinding.aspx


Reference:MSDN .NET Framework Class Library

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuiwebcontrolspageddatasourceclasstopic.asp


Paging with Repeater control in ASP.NET

http://www.charon.co.uk/content.aspx?CategoryID=28&ArticleID=21




发表评论:

    昵称:
    密码:
    主页:
    标题:
  • 本博客由放飞思想提供免费服务
  • www.flyidea.cn 放飞思想,成就未来
  • 本博客内部所有文章如需转载,请联系原作者或转载前作者