ReportViewer error "Page navigation is out of range"
- I am embedding the ReportViewer in an aspx page and the report comes up fine, but when I press the "Next Page" or "Last Page" buttons, I get the error: "Page navigation is out of range".
The application has session state turned off.
The problem occurs whether or not the viewstate for ReportViewer is turned on or off.
How can I fix this problem?
Answers
I figured out a workaround. It appears that the error occurs when you set the ServerPage during the postback. Don't explicitly set the ReportServerUrl or ReportPath during postback and it should work:
/* Insert the following two lines before setting ReportServerUrl or ReportPath */
if (IsPostBack)
return;Report.ServerReport.ReportServerUrl = new Uri(@"http://localhost/ReportServer");
Report.ServerReport.ReportPath = @"/MyReportDirectory/MyReport";
All Replies
- I have exactly the same problem...anyone out there from MS monitoring this??? Please help! Thanks!
I also had the same problem.
Can you try setting you internet-intranet security settings to Medium-Low and then try generating the reports? There seems to be some problem with storing of cookies because of which it gives this error.
Hope it helps!!!
- Page navigation is a postback. Look at what you are doing in the PageLoad when IsPostBack == true.
Hi BradB,
what are the things that can cause such error in the pageload if it's a postback?
i encountered this error but my coding uses !IsPostBack , will that be a difference?
I figured out a workaround. It appears that the error occurs when you set the ServerPage during the postback. Don't explicitly set the ReportServerUrl or ReportPath during postback and it should work:
/* Insert the following two lines before setting ReportServerUrl or ReportPath */
if (IsPostBack)
return;Report.ServerReport.ReportServerUrl = new Uri(@"http://localhost/ReportServer");
Report.ServerReport.ReportPath = @"/MyReportDirectory/MyReport";- thanks! works perfectly..
- That was it exactly. Thanks.
Perfect.
You made my day.
Thanx.

- How did you embed the ReportViewer to an aspx page mate ?? cos thats what im struggling with right now...
Colud you Please send me your code part for Page Navigationwow that was really helpfull,. Thanka a looooooooooooooooooooot
- A follow-up question on this - the workaround is great. I noticed that the "pages" are longer now than my paper size is set to (they seemed to match my paper size when async was set to true). Async I have 18 pages (same with PDF export) - No async and I only have 5 long pages. Any idea if there is a way to control/set this?
Thanks. - thanks, works fine for me.
Thanks Korggy....
Its a perfect solution .


