我正在使用用戶控件,並添加了我的報告查看器和自定義工具欄。我想爲它創建一個自定義導航,但由於某種原因,當我想檢查總頁面以決定是否顯示導航按鈕時,它會返回0或「此表達式會導致副作用,並且不會被評估」錯誤..reportviewer.LocalReport.GetTotalPages()返回0或錯誤
我已經跑出去的想法和不太肯定從這裏去..
<rsweb:reportviewer
ID="rvReports"
runat="server" ShowToolBar="False"
SizeToReportContent="True" AsyncRendering="false" />
代碼隱藏:
rds = new Microsoft.Reporting.WebForms.ReportDataSource("dsName", myclasstoload());
rvReports.LocalReport.DataSources.Add(rds);
rvReports.PageCountMode = PageCountMode.Actual;
rvReports.LocalReport.Refresh();
rvReports.DataBind();
if (rvReports.LocalReport.GetTotalPages() > 1)
{
liFirst.Visible = true;
liPrevious.Visible = true;
liNext.Visible = true;
liLast.Visible = true;
}
這是所有關於在數據綁定事件我usercontrol(.ascx)。任何幫助都不勝感激。