I am using ReportViewer 2010 to display a report into a ascx page (ascx page is loaded into aspx page). It displays first page properly. But when I click on next page, it loads the first page again. Even if I type in page number manually into the texttbox, it loads first page only. It seems like, it doesn't fire the pagenavigation event in the server side.If I set the currentpage property to 2 in code behind, then it loads page 2 every time. I am pasting the code where I am setting properties of the ReportViewer.
code behind page of xxxxx.ascx page
protected void Page_Load(object sender, EventArgs e)
{
// ReportViewer1.PageNavigation += new PageNavigationEventHandler(PageNavigation_Click);
if (Page.IsPostBack)
{
////.....some code to fetch data from sql server database.....
CapturedPlatesCountAdapter.Fill(CapturedPlatesCountDataSet);
ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
ReportViewer1.LocalReport.DataSources.Clear();
ReportDataSource obj1 = new ReportDataSource("DataSet1", CapturedPlatesCountDataSet.Tables[0]);
ReportViewer1.LocalReport.DataSources.Add(obj1);
ReportViewer1.ShowParameterPrompts = false;
ReportViewer1.LocalReport.EnableHyperlinks = true;
ReportViewer1.LocalReport.ReportPath = "CapturedPlatesCount.rdlc";
// ReportViewer1.AsyncRendering = false;
}
}
Here is the design code of xxxxx.ascx page
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Width="1100px"
Font-Names="Verdana" Font-Size="8pt" InteractiveDeviceInfos="(Collection)"
WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" Height="500px"
PageCountMode="Actual" AsyncRendering="False"
InteractivityPostBackMode="AlwaysSynchronous">
<localreport reportpath="CapturedPlatesCount.rdlc">
<datasources>
<rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="DataSet1" />
</datasources>
</localreport>
</rsweb:ReportViewer>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
SelectMethod="GetData"
TypeName="PlateSmartWebReport.ServiceModelTestDataSetTableAdapters.spPlateDetailsReportCountTableAdapter">
</asp:ObjectDataSource>
I looked into many forums to solve this issue. It looks like it was a bug in Report Viewer 2010. Is it resolved into new version of Report Viewer?
Please reply if you find any solution to this problem. Thanks in advance.