Note that there are some explanatory texts on larger screens.

plurals
  1. POError rendering ReportViewer (10.0.0.0 in LocalMode) directly to PDF when passing in an empty recordset
    primarykey
    data
    text
    <p>I have a utility method (below) that has always served me well. After databinding a report control, I pass the control to this and it renders the report as a PDF.</p> <p>I recently upgraded to .NET 4.0 and the new 2010 report viewer control (10.0.0.0). Now it throws the error (below) if the recordset (dataset) I pass to the reportviewer doesn't have any data.</p> <p>Any ideas? Thanks!</p> <p>ERROR (top 5):</p> <p>[InvalidOperationException: (processing): ScalableList: Index 0 outside the allowed range [0::-1]] Microsoft.ReportingServices.Diagnostics.Utilities.DefaultRSTraceInternal.Assert(Boolean condition, String componentName, String message) +176 Microsoft.ReportingServices.OnDemandProcessing.Scalability.ScalableList<code>1.get_Item(Int32 index) +212 Microsoft.ReportingServices.Rendering.HPBProcessing.PageStructStaticMemberCell.AddToPageCHContent(List</code>1 rowHeights, ScalableList`1 columnInfo, Int32 rowIndex, Int32 colIndex, Boolean isLTR, RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState, Boolean&amp; hasLabels) +60 Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.AddToPage(RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState) +781</p> <p>UTILITY METHOD:</p> <p>private static void renderReportAsPDF(ReportViewer reportViewer, HttpResponse response) {</p> <pre><code> Warning[] warnings; string[] streamids; string mimeType; string encoding; string extension; string reportName = reportViewer.LocalReport.DisplayName; byte[] bytes = reportViewer.LocalReport.Render("PDF", null, out mimeType, out encoding,out extension, out streamids, out warnings); response.Clear(); response.ContentType = mimeType; response.ContentEncoding = System.Text.Encoding.UTF32; response.BinaryWrite(bytes); response.End(); </code></pre> <p>}</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload