Asp.net 分页ObjectDataSource导致PageSize-1
我正在使用带有分页数据源的ListView。当ObjectDataSource尝试从“GetData”-方法获取数据时,参数PageSize设置为-1,即使我在DataPager中将PageSize设置为8 我忘了什么吗Asp.net 分页ObjectDataSource导致PageSize-1,asp.net,listview,asp.net-3.5,objectdatasource,datapager,Asp.net,Listview,Asp.net 3.5,Objectdatasource,Datapager,我正在使用带有分页数据源的ListView。当ObjectDataSource尝试从“GetData”-方法获取数据时,参数PageSize设置为-1,即使我在DataPager中将PageSize设置为8 我忘了什么吗 <asp:ListView DataSourceID="odsProductIndex" ID="lstProductIndex" runat="server" OnItemDataBound="lstProductIndex_ItemDataBound">
<asp:ListView DataSourceID="odsProductIndex" ID="lstProductIndex" runat="server" OnItemDataBound="lstProductIndex_ItemDataBound">
<LayoutTemplate>
<asp:PlaceHolder ID="itemPlaceHolder" runat="server"></asp:PlaceHolder>
<div class="Clear"></div>
<div id="Pagination">
<asp:DataPager ID="pagProductIndex" PageSize="8" runat="server" PagedControlID="lstProductIndex">
<Fields>
<asp:NextPreviousPagerField ButtonType="Image" ShowLastPageButton="false" ShowNextPageButton="false" PreviousPageImageUrl="~/Images/LexiconWord/Icons/pagination_previous.png" />
<asp:NumericPagerField ButtonCount="10" PreviousPageText="..." NextPageText="..." />
<asp:NextPreviousPagerField ButtonType="Image" ShowFirstPageButton="false" ShowPreviousPageButton="false" NextPageImageUrl="~/Images/LexiconWord/Icons/pagination_next.png" />
</Fields>
</asp:DataPager>
</div>
</LayoutTemplate>
<ItemTemplate>
<!-- ITEM TEMPLATE HERE -->
</ItemTemplate>
<EmptyDataTemplate>
No products found...
</EmptyDataTemplate>
</asp:ListView>
<asp:ObjectDataSource ID="odsProductIndex" runat="server"
EnablePaging="true"
SelectMethod="GetData">
</asp:ObjectDataSource>
没有找到任何产品。。。
通过将ObjectDataSource修改为:
<asp:ObjectDataSource ID="odsProductIndex"
runat="server"
EnablePaging="true"
MaximumRowsParameterName="maximumRows"
StartRowIndexParameterName="startRowIndex"
SelectMethod="GetData">
<SelectParameters>
<asp:Parameter Name="maximumRows" DefaultValue="8" />
<asp:Parameter Name="startRowIndex" DefaultValue="0" />
</SelectParameters>
</asp:ObjectDataSource>