Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# ASP.NET DataPager查看所有记录_C#_Asp.net_Paging_Web Controls - Fatal编程技术网

C# ASP.NET DataPager查看所有记录

C# ASP.NET DataPager查看所有记录,c#,asp.net,paging,web-controls,C#,Asp.net,Paging,Web Controls,听起来很简单-我有一个与datalist关联的datapager: <asp:DataPager runat="server" ID="uxPager" PageSize="10" PagedControlID="uxDataList" QueryStringField="page"> <Fields> <asp:NextPreviousPagerField FirstPageText="&lt;&lt;" Sho

听起来很简单-我有一个与datalist关联的datapager:

<asp:DataPager runat="server" ID="uxPager" PageSize="10" 
    PagedControlID="uxDataList" QueryStringField="page">
<Fields>
    <asp:NextPreviousPagerField FirstPageText="&lt;&lt;" 
        ShowFirstPageButton="True" ShowNextPageButton="False"
        ShowPreviousPageButton="False" />
    <asp:TemplatePagerField OnPagerCommand="PagerCommand">
        <PagerTemplate>
            Page
            <asp:Label runat="server" ID="CurrentPageLabel" 
                Text="<%# Container.TotalRowCount>0 ? 
                    (Container.StartRowIndex / Container.PageSize) + 1 : 0 %>" />
            of
            <asp:Label runat="server" ID="TotalPagesLabel" 
                Text="<%# Math.Ceiling (
                    (double)Container.TotalRowCount / Container.PageSize) %>" />
            <asp:LinkButton ID="lbViewAll" runat="server" OnClick="ViewAll">
                View All
            </asp:LinkButton>
        </PagerTemplate>
    </asp:TemplatePagerField>
    <asp:NextPreviousPagerField LastPageText="&gt;&gt;" 
        ShowLastPageButton="True" ShowNextPageButton="true" 
        ShowPreviousPageButton="True" PreviousPageText="Prev" 
        NextPageText="Next" />
</Fields>
当我逐步遍历它时,我的数据列表有95个项(这是我所期望的),但是数据列表呈现我的EmptyDataTemplate,即使我调用了DataBind()


如果有什么不同,我将使用XmlDataSource来驱动数据列表。

受保护的void ViewAll(对象发送方,EventArgs e)这是由名为lbViewAll的按钮触发的吗?我有点困惑filldata实际上做了什么?换句话说,它真的能获取所有数据吗?
        /// <summary>
    /// Views all.
    /// </summary>
    /// <param name="sender">The sender.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> 
    ///     instance containing the event data.</param>


    protected void ViewAll(object sender, EventArgs e)
    {
        uxServiceDirectoryPager.SetPageProperties(0,
            uxServiceDirectoryPager.TotalRowCount,true);
    }
uxServiceDirectoryPager.SetPageProperties(0, uxServiceDirectoryPager.TotalRowCount, true);
        uxServiceDirectoryList.DataBind();