Search code examples
c#asp.netteleriktelerik-gridexport-to-pdf

Export telerik RadGrid to PDF


I have a Telerik RadGrid with NestedViewTemplate, when exporting it to PDF, it results in a corrupted file.

<NestedViewTemplate>
    <div runat="server" class="width-full">
        <span><%# Eval("Notes") %></span>
    </div>
</NestedViewTemplate>

Edit: the same grid but without this column (NestedViewTemplate) works fine and the export results in a well-formatted pdf file


Solution

  • I got it!

    There is an exception log says:

    Invalid XHTML. RadGrid has to render correct XHTML in order to export to PDF. Parse error: The 'br' start tag on line 778 position 6734 does not match the end tag of 'span'...

    The note contains some HTML tags and the <br> tag is not valid XHTML tag, So, I replaced every <br> by <br/>, and it works properly now