I understand there is no current support for directly creating a PDF from a PivotGrid.
I am attempting to use a third party pdf generator to produce a pdf. I am attempting to use the PivotGrid's RenderControl method to capture the PivotGrid's HTML and push that HTML to the third party pdf generator.
Here is the code I'm using to attempt to create a PDF from the PivotGrid:
01.Protected Sub exportPDF_OnClick(ByVal sender As Object, ByVal e As EventArgs)
02. Dim stringBuilder As New System.Text.StringBuilder
03. Dim stringWriter As New System.IO.StringWriter(stringBuilder)
04. Dim pivotGridHtml As String
05. Dim htmlTextWriter As New HtmlTextWriter(stringWriter)
06.
07. pivotGrid.RenderControl(htmlTextWriter)
08. pivotGridHtml = stringBuilder.ToString()
09. PdfGenerator.GetDefaultPdfGenerator().HTMLToPDF(pivotGridHtml)
10.
11.End Sub
Attempts to create a pdf fail on the call to RenderControl. The expand/collapse buttons are causing me trouble. I'm getting the error below:
Control 'ctl00_FeaturedContent_pivotGrid_ctl04_ctl00_RowExpandCollapseButton_0_0' of type 'Button' must be placed inside a form tag with runat=server.
Is there a different approach I can take? Or can I make the PivotGrid not create the expand/collapse buttons?