| 1 |
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MyPage.aspx.cs" Inherits="MyPage" EnableViewState="false" %> |
| 2 |
<%@ Import Namespace="System.Collections.Generic" %> |
| 3 |
<%@ Import Namespace="System.Linq" %> |
| 4 |
|
| 5 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 6 |
|
| 7 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
| 8 |
<head id="Head1" runat="server"> |
| 9 |
<title>Untitled Page</title> |
| 10 |
</head> |
| 11 |
<body> |
| 12 |
<form id="form1" runat="server"> |
| 13 |
<div> |
| 14 |
<%= MonoTests.stand_alone.WebHarness.HtmlDiff.BEGIN_TAG %><asp:ListView ID="ListViewTest2" DataSourceID="ObjectDataSource1" runat="server" > |
| 15 |
<ItemTemplate><%# Container.DataItem %></ItemTemplate> |
| 16 |
<LayoutTemplate> |
| 17 |
<div runat="server" id="itemPlaceHolder"></div> |
| 18 |
</LayoutTemplate> |
| 19 |
</asp:ListView> |
| 20 |
<asp:DataPager runat="server" ID="DataPager1" PagedControlID="ListViewTest2"> |
| 21 |
<Fields> |
| 22 |
<asp:NextPreviousPagerField ButtonType="Link" ShowFirstPageButton="true" |
| 23 |
ShowLastPageButton="false" ShowNextPageButton="false" ShowPreviousPageButton="true"/> |
| 24 |
<asp:NumericPagerField ButtonCount="5" /> |
| 25 |
<asp:NextPreviousPagerField ButtonType="Link" ShowFirstPageButton="false" |
| 26 |
ShowLastPageButton="true" ShowNextPageButton="true" ShowPreviousPageButton="false" /> |
| 27 |
</Fields> |
| 28 |
</asp:DataPager> |
| 29 |
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" EnablePaging="True" |
| 30 |
SelectMethod="GetPagedData" SelectCountMethod="GetCount"> |
| 31 |
</asp:ObjectDataSource> |
| 32 |
<br /><div> |
| 33 |
DataPager.TotalRowCount = <%=DataPager1.TotalRowCount%><br /> |
| 34 |
Actual TotalRowCount = <%=this.GetCount()%></div><%= MonoTests.stand_alone.WebHarness.HtmlDiff.END_TAG %> |
| 35 |
</div> |
| 36 |
<script runat="server" type="text/C#"> |
| 37 |
protected void Page_Load(object sender, EventArgs e) |
| 38 |
{ |
| 39 |
ObjectDataSource1.TypeName = sender.GetType().AssemblyQualifiedName; |
| 40 |
} |
| 41 |
|
| 42 |
public List<int> GetPagedData(int startRowIndex, int maximumRows) |
| 43 |
{ |
| 44 |
return GetAllData().Skip(startRowIndex).Take(maximumRows).ToList(); |
| 45 |
} |
| 46 |
|
| 47 |
public int GetCount() |
| 48 |
{ |
| 49 |
return GetAllData().Length; |
| 50 |
} |
| 51 |
|
| 52 |
public int[] GetAllData() |
| 53 |
{ |
| 54 |
return new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; |
| 55 |
} |
| 56 |
</script> |
| 57 |
</form> |
| 58 |
</body> |
| 59 |
</html> |