0
我正在使用DevExpress GridView
。我只需要在最後一頁顯示總計。所以,我需要檢查grid.PageIndex == grid.PageCount
。但PageIndex
被設置爲不相關的隨機數字(至少我沒有找到任何邏輯),我不知道我的代碼中缺少什麼。Devexpress GridView.PageIndex值有誤
<dx:ASPxGridView ID="GrdMain" ClientInstanceName="GrdMain" runat="server"
KeyFieldName="SomeId" Width="100%" AutoGenerateColumns="False">
<Columns>
<dx:GridViewDataTextColumn FieldName="Debit" VisibleIndex="6" UnboundType="Decimal">
</dx:GridViewDataTextColumn>
</Columns>
<Settings ShowFooter="True" />
<TotalSummary>
<dx:ASPxSummaryItem FieldName="Debit" SummaryType="Sum"/>
</TotalSummary>
而後面的代碼:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
grid.SettingsPager.PageSize = 25;
grid.ForceDataRowType(typeof(SomeTypeView));
}
SetGridDataSource();
}
private void SetGridDataSource()
{
grid.DataSource = GetListOfSomeType();
grid.DataBind();
grid.Settings.ShowFooter = (grid.PageIndex == grid.PageCount - 1);
}