Hi I got an error when exporting to PDF :
Invalid XHTML. RadGrid has to render correct XHTML in order to export to PDF.
Parse error:
The '@' character, hexadecimal value 0x40, cannot be included in a name. Line 1746, position 161.
at line:
<td> </td><td>12379182</td><td>43289573</td><td>test</td><td>tester</td><td>0147238</td><td>"Tom & test tester" <tester@bigpond.net.au></td>
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Telerik.Web.UI.Grid.Export.GridPdfExportException: Invalid XHTML. RadGrid has to render correct XHTML in order to export to PDF.
Parse error:
The '@' character, hexadecimal value 0x40, cannot be included in a name. Line 1746, position 161.
at line:
<td> </td><td>770547771</td><td>661576901</td><td>Antheunis</td><td>tester</td><td>0147238</td><td>"Tom & test tester" <tester@bigpond.net.au></td>
It seems that this happens when there is a email with <something@something.com> in the field value
Is there a event handler that I can overwrite to handle this when data is being populated to the PDF?
Thanks.
Invalid XHTML. RadGrid has to render correct XHTML in order to export to PDF.
Parse error:
The '@' character, hexadecimal value 0x40, cannot be included in a name. Line 1746, position 161.
at line:
<td> </td><td>12379182</td><td>43289573</td><td>test</td><td>tester</td><td>0147238</td><td>"Tom & test tester" <tester@bigpond.net.au></td>
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Telerik.Web.UI.Grid.Export.GridPdfExportException: Invalid XHTML. RadGrid has to render correct XHTML in order to export to PDF.
Parse error:
The '@' character, hexadecimal value 0x40, cannot be included in a name. Line 1746, position 161.
at line:
<td> </td><td>770547771</td><td>661576901</td><td>Antheunis</td><td>tester</td><td>0147238</td><td>"Tom & test tester" <tester@bigpond.net.au></td>
It seems that this happens when there is a email with <something@something.com> in the field value
Is there a event handler that I can overwrite to handle this when data is being populated to the PDF?
Thanks.
7 Answers, 1 is accepted
0

Pedro
Top achievements
Rank 1
answered on 13 Nov 2014, 10:12 PM
I'm having the same problem.
I even get the error:
"Invalid XHTML. RadGrid has to render correct XHTML in order to export to PDF.
Parse error:
The 'body' start tag on line 674 position 6 does not match the end tag of 'td'. Line 675, position 15.
at line:
</td> "
when I run the telerik demo TelerikUI_for_AspNetAjax/grid/examples/functionality/exporting/pdf-export/defaultcs.aspx.
Is this a bug created with the last release?
I even get the error:
"Invalid XHTML. RadGrid has to render correct XHTML in order to export to PDF.
Parse error:
The 'body' start tag on line 674 position 6 does not match the end tag of 'td'. Line 675, position 15.
at line:
</td> "
when I run the telerik demo TelerikUI_for_AspNetAjax/grid/examples/functionality/exporting/pdf-export/defaultcs.aspx.
Is this a bug created with the last release?
0
Hello Anthony,
You can hook OnPrdExporting event handler and get the rendered html. On this event you can manually modify the output string.
Hello Pedro,
I am afraid I was unable to replicate the issue locally. Could you please let me know whether you have made some modification of the code? I would appreciate if you can provide the steps which you have followed in order to replicate the issue on my side.
Regards,
Kostadin
Telerik
You can hook OnPrdExporting event handler and get the rendered html. On this event you can manually modify the output string.
Hello Pedro,
I am afraid I was unable to replicate the issue locally. Could you please let me know whether you have made some modification of the code? I would appreciate if you can provide the steps which you have followed in order to replicate the issue on my side.
Regards,
Kostadin
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0

Tim
Top achievements
Rank 1
answered on 17 Nov 2014, 02:20 PM
Invalid XHTML. RadGrid has to render correct XHTML in order to export to PDF.
Parse error:
The 'body' start tag on line 674 position 6 does not match the end tag of 'td'. Line 677, position 23.
at line:
</td><td>test trans</td><td> </td><td>sdcqsdc qsdcvqsdc</td><td>John Deere</td><td>Test Retailer</td><td>11-14-2014</td><td>Approved with Callback</td>
Something odd on this one...
All works unless I use an ItemTemplate... The fail.
<ItemTemplate>
<%# Eval("Claim_ID") %>
</ItemTemplate>
Claim_ID = "wc-0000000"
Other exporting is just fine.. PDF has the issue.
Parse error:
The 'body' start tag on line 674 position 6 does not match the end tag of 'td'. Line 677, position 23.
at line:
</td><td>test trans</td><td> </td><td>sdcqsdc qsdcvqsdc</td><td>John Deere</td><td>Test Retailer</td><td>11-14-2014</td><td>Approved with Callback</td>
Something odd on this one...
All works unless I use an ItemTemplate... The fail.
<ItemTemplate>
<%# Eval("Claim_ID") %>
</ItemTemplate>
Claim_ID = "wc-0000000"
Other exporting is just fine.. PDF has the issue.
0

Tim
Top achievements
Rank 1
answered on 17 Nov 2014, 10:52 PM
Looks like .. at least for me... PDF export cant handle the <%# %> binding... changed from template and it works just fine...
0
Hi Tim,
I prepared a small sample which demonstrates exporting of template columns and attached it to this thread. Could you please give it a try and let me know how it differs from your real setup?
Regards,
Kostadin
Telerik
I prepared a small sample which demonstrates exporting of template columns and attached it to this thread. Could you please give it a try and let me know how it differs from your real setup?
Regards,
Kostadin
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0

Tim
Top achievements
Rank 1
answered on 20 Nov 2014, 06:53 PM
This should get you what you need.. I think the source of the problem is with filtering on... I was able to get the same results after modifying you example to this.. no time to debug any further today so I could not narrow the issue. Good luck!
~Tim
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
<
Scripts
>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.Core.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQuery.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQueryInclude.js"
/>
</
Scripts
>
</
telerik:RadScriptManager
>
<
script
type
=
"text/javascript"
>
//Put your JavaScript code here.
</
script
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
</
telerik:RadAjaxManager
>
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AllowPaging
=
"True"
AllowSorting
=
"True"
RenderMode
=
"Auto"
AutoGenerateColumns
=
"False"
DataSourceID
=
"Sql_Test"
Skin
=
"Metro"
CellSpacing
=
"-1"
GridLines
=
"Both"
Height
=
"400px"
>
<
ClientSettings
AllowColumnsReorder
=
"true"
AllowColumnHide
=
"true"
>
<
Selecting
AllowRowSelect
=
"true"
/>
</
ClientSettings
>
<
MasterTableView
DataKeyNames
=
"Column1"
DataSourceID
=
"Sql_Test"
AllowFilteringByColumn
=
"true"
CommandItemDisplay
=
"Top"
EnableHeaderContextMenu
=
"true"
EnableHeaderContextFilterMenu
=
"true"
>
<
CommandItemSettings
ShowAddNewRecordButton
=
"false"
ShowExportToCsvButton
=
"true"
ShowExportToExcelButton
=
"true"
ShowExportToPdfButton
=
"true"
ShowExportToWordButton
=
"true"
/>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"Column1"
HeaderText
=
"Column1"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Column2"
HeaderText
=
"Column2"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Column3"
HeaderText
=
"Column3"
></
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Column4"
>
<
ItemTemplate
>
<%# Eval("Column4") %>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
<
asp:SqlDataSource
ID
=
"Sql_Test"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT 'Col3Row1' AS Column1, 'Col3Row1' AS Column2, 'Col3Row1' AS Column3, 'wc-00000001' AS Column4
UNION
SELECT 'Col3Row2' AS Column1, 'Col3Row2' AS Column2, 'Col3Row2' AS Column3, 'wc-00000002' AS Column4
UNION
SELECT 'Col3Row3' AS Column1, 'Col3Row3' AS Column2, 'Col3Row3' AS Column3, 'wc-00000003' AS Column4
UNION
SELECT 'Col3Row4' AS Column1, 'Col3Row4' AS Column2, 'Col3Row4' AS Column3, 'wc-00000004' AS Column4"
></
asp:SqlDataSource
>
</
form
>
0
Hello Tim,
On my side the provide code works correctly and the template columns' data is exported. Could you please let me know which version of RadControl you are using?
Regards,
Kostadin
Telerik
On my side the provide code works correctly and the template columns' data is exported. Could you please let me know which version of RadControl you are using?
Regards,
Kostadin
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.