DataPager分页问题,ListView重新绑定数据源后DataPager未回到初始页?
如题:
ListView用ObjectDataSource做数据源
当根据查询条件重新绑定后,DataPager没有回到初始页
就是原来我如果选择了第三页,ListView正常显示出来
这时候根据查询条件ListView数据源变了,但是DataPager还是停留在了第三页,怎么让它回到初始页
<asp:HiddenField ID="hf_category" runat="server" />
<div class="alPage">
<asp:DataPager ID="dp_party" runat="server" PagedControlID="repList" PageSize="2"
EnableViewState="false">
<Fields>
<asp:TemplatePagerField>
<PagerTemplate>
共<%= DataCount%>条记录, 当前第<asp:Label runat="server" ID="CurrentPageLabel" Text="<%# Container.TotalRowCount>0 ? (Container.StartRowIndex / Container.PageSize) + 1 : 0 %>" />/<asp:Label
runat="server" ID="TotalPagesLabel" Text="<%# Math.Ceiling ((double)Container.TotalRowCount / Container.PageSize) %>" />页,
</PagerTemplate>
</asp:TemplatePagerField>
<asp:NextPreviousPagerField ButtonType="Link" ShowFirstPageButton="true" ShowPreviousPageButton="true"
ShowLastPageButton="false" ShowNextPageButton="false" FirstPageText="首页" ButtonCssClass="PageCss"
PreviousPageText="上页" />
<asp:NumericPagerField />
<asp:NextPreviousPagerField ButtonType="Link" ShowNextPageButton="true" ShowLastPageButton="true"
ShowFirstPageButton="false" ShowPreviousPageButton="false" LastPageText="末页"
ButtonCssClass="PageCss"
NextPageText="下页" />
</Fields>
</asp:DataPager>
<asp:ObjectDataSource ID="ods_repository" runat="server" SelectMethod="GetData"
TypeName="ZWW.BLLNEW.ZZK.PageBusiness" MaximumRowsParameterName="pageSize" StartRowIndexParameterName="startIndex"
EnablePaging="True" SelectCountMethod="GetAmount" EnableViewState="false">
<SelectParameters>
<asp:ControlParameter ControlID="hf_category" Name="category_id" PropertyName="Value"
Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
</div>