GridView控件分页问题:情况如下:数据源:<asp:ObjectDataSource ID="sourceCurrent" runat="server" SelectMethod="GetDataTableDataSetByPage"
TypeName="Default" OnSelected="sourceCurrent_Selected">
<SelectParameters>
<asp:Parameter Name="currentPageIndex" Type="Int32" DefaultValue="0" />
<asp:Parameter DefaultValue="10" Name="pageSize" Type="Int32" />
<asp:Parameter DefaultValue="表名" Name="dataTableCode" Type="String" />
<asp:Parameter DefaultValue="[表名唯一标识]" Name="dataKeyCode" Type="String" />
<asp:Parameter DefaultValue="false" Name="descFlag" Type="Boolean" />
<asp:Parameter Name="searchCondition" Type="String" DefaultValue="1 = 2" />
</SelectParameters>
</asp:ObjectDataSource>
后面代码: //初始化
int count = DictionaryAppI.GetDataTableItemCount(SearchCondition, "IPayment_PayFeeLogVW"); //设置分页栏
//PageSize =10
pagerCurrentTop.RecordCount = pagerCurrentBottom.RecordCount = count;
pagerCurrentTop.CurrentPageIndex = pagerCurrentBottom.CurrentPageIndex = PageIndex + 1;
pagerCurrentTop.PageSize = pagerCurrentBottom.PageSize = PageSize;
if (PageIndex > pagerCurrentBottom.PageCount)
{
PageIndex = pagerCurrentBottom.PageCount - 1;
}
pagerCurrentBottom.CustomInfoText = "[记录数:<b>" + pagerCurrentBottom.RecordCount + "</b>] [当前页码/页数:<b>" + (PageIndex + 1) + "/" + (pagerCurrentBottom.PageCount == 0 ? 1 : pagerCurrentBottom.PageCount) + "</b>]";问题描述:当我们第一次查询的时候查出的记录有100条,我们查看第5页的时候,然后又用查询条件(条件和上次查询条件不同)对表重新查询一次,查出是8条记录,只是单页面只显示一天记录,下面的分页栏显示的:[记录数:8][当前页面/页数:5/1]。
请高手赐教
TypeName="Default" OnSelected="sourceCurrent_Selected">
<SelectParameters>
<asp:Parameter Name="currentPageIndex" Type="Int32" DefaultValue="0" />
<asp:Parameter DefaultValue="10" Name="pageSize" Type="Int32" />
<asp:Parameter DefaultValue="表名" Name="dataTableCode" Type="String" />
<asp:Parameter DefaultValue="[表名唯一标识]" Name="dataKeyCode" Type="String" />
<asp:Parameter DefaultValue="false" Name="descFlag" Type="Boolean" />
<asp:Parameter Name="searchCondition" Type="String" DefaultValue="1 = 2" />
</SelectParameters>
</asp:ObjectDataSource>
后面代码: //初始化
int count = DictionaryAppI.GetDataTableItemCount(SearchCondition, "IPayment_PayFeeLogVW"); //设置分页栏
//PageSize =10
pagerCurrentTop.RecordCount = pagerCurrentBottom.RecordCount = count;
pagerCurrentTop.CurrentPageIndex = pagerCurrentBottom.CurrentPageIndex = PageIndex + 1;
pagerCurrentTop.PageSize = pagerCurrentBottom.PageSize = PageSize;
if (PageIndex > pagerCurrentBottom.PageCount)
{
PageIndex = pagerCurrentBottom.PageCount - 1;
}
pagerCurrentBottom.CustomInfoText = "[记录数:<b>" + pagerCurrentBottom.RecordCount + "</b>] [当前页码/页数:<b>" + (PageIndex + 1) + "/" + (pagerCurrentBottom.PageCount == 0 ? 1 : pagerCurrentBottom.PageCount) + "</b>]";问题描述:当我们第一次查询的时候查出的记录有100条,我们查看第5页的时候,然后又用查询条件(条件和上次查询条件不同)对表重新查询一次,查出是8条记录,只是单页面只显示一天记录,下面的分页栏显示的:[记录数:8][当前页面/页数:5/1]。
请高手赐教
//设置数据源
sourceCurrent.SelectParameters["searchCondition"].DefaultValue = resultCondition;
sourceCurrent.SelectParameters["pageSize"].DefaultValue = PageSize.ToString();
sourceCurrent.SelectParameters["currentPageIndex"].DefaultValue = SysFunction.StringParse(PageIndex);