ListViewTotalRowCount_Bug535701_2.aspx 2.3 KB

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