28 Answers, 1 is accepted

I am not exactly sure about this issue. But can you check whether you have set the Width/Height of the Grid anywhere in percentage? If so try setting the widtth/height in pixels and see whether the error is getting removed.
Shinu

Hello Paul,
Is it possible that you enabled custom paging for your grid when using ObjectDataSource item generator as shown in this demo? If so, verify that you set the page size of the grid to match its VirtualItemCount value as explained in the bottom section of the following help topic:
http://www.telerik.com/help/aspnet-ajax/grdexport.html
Kind regards,
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.

I got the same error, when i export to pdf with no record in RadGrid.
Plz, Help me!!
Best regards,
Le
Can you please verify that you are using the latest version 2009.1.402 of RadControls for ASP.NET AJAX in your project? Similar issue has been reported before and it should be addressed in the latest release of the suite. Upgrade instructions can be found here.
Best regards,
Sebastian
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.

I am using the latest version 2009.1.402 and my Radgrid is set into pixels and and not percentages and I am still receiving the error.
I've taken a look at this thread:
http://www.telerik.com/community/forums/aspnet-ajax/grid/working-with-exporttopdf.aspx
But I don't really understand it, if anyone can, can they explain it to me, might be because the decription is in VB and I am working with C#
Any help would be appreciated!
Regards,
Lily
In order to provide up-to-the-point answer for your case, I will request that you assemble a stripped working version of your project, exhibiting the erroneous behavior, and send it enclosed to a regular support ticket. We will test/debug it locally and will get around to you with your findings.
Best regards,
Sebastian
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.

After receiving this error intermittantly, I reviewed the html being exported from the grid and found that if I had a <DIV> tag with the width style set:
<div id="ctl00_ContentPlaceHolder1_panelAccidentListing" style="width: 100%">
I would receive the error:
System.InvalidCastException: Unable to cast object of type 'Telerik.Apoc.Layout.BlockArea' to type 'Telerik.Apoc.Layout.AreaContainer'.
at Telerik.Apoc.Fo.Flow.BlockContainer.Layout(Area area)
at Telerik.Apoc.Fo.Flow.Block.Layout(Area area)
at Telerik.Apoc.Fo.Flow.Block.Layout(Area area)
at Telerik.Apoc.Fo.Flow.TableCell.Layout(Area area)
at Telerik.Apoc.Fo.Flow.TableRow.Layout(Area area)
at Telerik.Apoc.Fo.Flow.AbstractTableBody.Layout(Area area)
at Telerik.Apoc.Fo.Flow.Table.Layout(Area area)
at Telerik.Apoc.Fo.Flow.Block.Layout(Area area)
at Telerik.Apoc.Fo.Flow.Flow.Layout(Area area, Region region)
at Telerik.Apoc.Fo.Flow.Flow.Layout(Area area)
at Telerik.Apoc.Fo.Pagination.PageSequence.Format(AreaTree areaTree)
at Telerik.Apoc.StreamRenderer.Render(PageSequence pageSequence)
at Telerik.Apoc.Fo.FOTreeBuilder.EndElement()
at Telerik.Apoc.Fo.FOTreeBuilder.Parse(XmlReader reader)
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.
Removing width solved our problem.

System.InvalidCastException: Unable to cast object of type 'Telerik.Web.Apoc.Layout.BlockArea' to type 'Telerik.Web.Apoc.Layout.AreaContainer'. |
at Telerik.Web.Apoc.Fo.Flow.BlockContainer.Layout(Area area) |
at Telerik.Web.Apoc.Fo.Flow.Block.Layout(Area area) |
at Telerik.Web.Apoc.Fo.Flow.TableCell.Layout(Area area) |
at Telerik.Web.Apoc.Fo.Flow.TableRow.Layout(Area area) |
at Telerik.Web.Apoc.Fo.Flow.AbstractTableBody.Layout(Area area) |
at Telerik.Web.Apoc.Fo.Flow.Table.Layout(Area area) |
at Telerik.Web.Apoc.Fo.Flow.Block.Layout(Area area) |
at Telerik.Web.Apoc.Fo.Flow.Flow.Layout(Area area, Region region) |
at Telerik.Web.Apoc.Fo.Flow.Flow.Layout(Area area) |
at Telerik.Web.Apoc.Fo.Pagination.PageSequence.Format(AreaTree areaTree) |
at Telerik.Web.Apoc.StreamRenderer.Render(PageSequence pageSequence) |
at Telerik.Web.Apoc.Fo.FOTreeBuilder.EndElement() |
at Telerik.Web.Apoc.Fo.FOTreeBuilder.Parse(XmlReader reader) |
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server"> |
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> |
<AjaxSettings> |
<telerik:AjaxSetting AjaxControlID="RadGrid1"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
</AjaxSettings> |
</telerik:RadAjaxManager> |
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" /> |
<telerik:RadGrid ID="RadGrid1" ShowGroupPanel="true" DataSourceID="source1" AllowPaging="True" |
runat="server" AllowSorting="True" ShowHeader ="false" AllowFilteringByColumn="true"> |
<ExportSettings IgnorePaging="true" OpenInNewWindow="true"> |
<Pdf PageHeight="300mm" PageWidth="300mm" PageTitle="Catalogue" /> |
</ExportSettings> |
<PagerStyle Mode="NextPrevAndNumeric" /> |
<MasterTableView CommandItemDisplay="Top" DataKeyNames="ProductId"> |
<CommandItemTemplate> |
<asp:Button ID="DownloadPDF" Visible="true" runat="server" Width="100%" CommandName="ExportToPdf" /> |
</CommandItemTemplate> |
<ItemTemplate> |
<table> |
<tr> |
<td> |
<telerik:RadBinaryImage ID="RadBinaryImage1" runat="server" AutoAdjustImageControlSize="false" |
DataValue='<%#Eval("PictureBinary") %>' Height="200px" Width="170px" /> |
</td> |
<td> |
<div> |
<span style="font-weight: bold; font-family: Arial Black;">Name:</span> |
<%#Eval("ProductName")%> |
<br /> |
<br /> |
<span style="font-weight: bold; font-family: Arial Black;">Price:</span> |
<%#Eval("Cost", "{0:C2}")%> |
<br /> |
<br /> |
<span style="font-weight: bold;">Quantity:</span> |
<%#Eval("Stock") & " available"%> |
<br /> |
<br /> |
<span style="font-weight: bold;">Rate:</span> |
<telerik:RadRating ID="RadRating1" runat="server" ItemCount="5" Value='<%#Eval("RatingSum")%>' |
Skin="Hay" ReadOnly="true" /> |
<br /> |
<br /> |
<span style="font-weight: bold;">Description:</span> |
<%#Eval("ShortDesc")%> |
</div> |
</td> |
</tr> |
</table> |
</ItemTemplate> |
</MasterTableView> |
<ClientSettings AllowDragToGroup="true"> |
<Scrolling AllowScroll="true" UseStaticHeaders="true" /> |
</ClientSettings> |
</telerik:RadGrid> |
<asp:SqlDataSource ID="source1" runat="server" SelectCommand="select Product.*, Picture.* |
from Product, Category, SubCategory, Product_Category_Mapping, Picture |
where ProductProduct_Category_Mapping.ProductId=Product.ProductId and Product_Category_Mapping.CategoryId=Category.CategoryId and Product_Category_Mapping.SubCategoryId=SubCategory.SubCategoryId and Picture.PictureId in (select top 1 PictureId from Picture as pp where pp.ProductId=Product.ProductId )" |
ConnectionString="<%$ ConnectionStrings:sshopConnectionString %>"></asp:SqlDataSource> |
</asp:Content> |
Please examine the information from the relevant bullet in the 'Exceptions' paragraph of this documentation article.
Best regards,
Sebastian
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.

I am not sure if this thread is closed but i got the same error as cute gal when i tried to export a radgrid to PDF.
I am using template grid as shown in her example with no nested div's. My table is setting inline widths but i tried removing them and exporting and still no difference.
Most forums suggest to remove the widths of the div's to get it to work but that does not seem to help.
Also it makes little sense to change the style of my grid to get this functionality working.
Is this a known issue with radgrid that has not been solved yet?
Any help would be greatly appreciated.
Kind Regards,
Paul
Can you post your grid markup in this forum post to investigate this case further? I presume that you already took into account the info provided in the help topic.
Also specify the version of our ASP.NET AJAX controls you are using (the most recent available is 2011.2.915).
Best regards,
Sebastian
the Telerik team

AllowFilteringByColumn="true"
on my RadGrid that I will receive the error in this thread. As soon as I set it to False I can receive a pdf export.
I'm still searching on a way to fix this issue, but this could be the issue everyone else is experiencing...

I have more to offer on this. Ends up it was my GridDateTimeColumn causing the error.
<
telerik:GridDateTimeColumn
AllowFiltering
=
"true"
DataFormatString
=
"{0: MM/dd/yyyy}"
DataField
=
"ExpirationDate"
HeaderText
=
"Expires Date"
SortExpression
=
"ExpirationDate"
UniqueName
=
"ExpirationDate"
></
telerik:GridDateTimeColumn
>
With AllowFiltering="true", I get the error every time. When I set it to "false", I can export to pdf. So, it appears you can't have filtering on a datetimecolumn when you want to export to pdf.
Can telerik confirm this and let me know if this is by design or an issue?

It could be how you described it as even I had a GridDateTimeColumn that was allowed to be filtered. I did not go through finding a solution for this since time did not allow it and I had to come up with a solution quickly. I used 'itextsharp' to create a custom pdf file as the clients wanted.
It would be great if someone from Telerik could confirm if this was the issue though.
Kind Regards
Paul
I tried to reproduce the issue using GridDateTimeColumn and enabling filtering for the grid (with v2011.2.915 of our AJAX controls) but unfortunately to no avail.
If you can replicate the abnormality, please submit a stripped down working version of your project that illustrates it in a standard support ticket. Thus we will investigate the case further and provide an appropriate answer/fix.
Kind regards,
Sebastian
the Telerik team


There are two ways to sidestep the problem:
- set ExportOnlyData to true
- turn off filtering before exporting (in the export button handler or in the ItemCommand handler if using the built-in export buttons)
Note that both of the solutions are completely safe and won't affect your application as they will be applied to the exported file only.
Regards,
Daniel
the Telerik team

In the ItemCommand I catch the EpxortToPDF command and set EpxortOnlyData to true and diabled filtering by setting AllowFilterByColumn on the grid to false. But still I receive the following error:
Server Error in '/' Application.
--------------------------------------------------------------------------------
System.InvalidCastException: Unable to cast object of type 'Telerik.Web.Apoc.Layout.BlockArea' to type 'Telerik.Web.Apoc.Layout.AreaContainer'.
at Telerik.Web.Apoc.Fo.Flow.BlockContainer.Layout(Area area)
at Telerik.Web.Apoc.Fo.Flow.Block.Layout(Area area)
at Telerik.Web.Apoc.Fo.Flow.Block.Layout(Area area)
at Telerik.Web.Apoc.Fo.Flow.Block.Layout(Area area)
at Telerik.Web.Apoc.Fo.Flow.TableCell.Layout(Area area)
at Telerik.Web.Apoc.Fo.Flow.TableRow.Layout(Area area)
at Telerik.Web.Apoc.Fo.Flow.AbstractTableBody.Layout(Area area)
at Telerik.Web.Apoc.Fo.Flow.Table.Layout(Area area)
at Telerik.Web.Apoc.Fo.Flow.Block.Layout(Area area)
at Telerik.Web.Apoc.Fo.Flow.Flow.Layout(Area area, Region region)
at Telerik.Web.Apoc.Fo.Flow.Flow.Layout(Area area)
at Telerik.Web.Apoc.Fo.Pagination.PageSequence.Format(AreaTree areaTree)
at Telerik.Web.Apoc.StreamRenderer.Render(PageSequence pageSequence)
at Telerik.Web.Apoc.Fo.FOTreeBuilder.EndElement()
at Telerik.Web.Apoc.Fo.FOTreeBuilder.Parse(XmlReader reader)
Regards,
Jos

This issue arises when you have DIV element with specified dimensions or absolute positioning. Check the following help documentation which explains more about this.
PDF export.
-Shinu.

I removed all height, width and positioning properties of the div's around the grid without any results.
The problem occured when I moved my CommandItems from the CommandItemTemplate to the PagerTemplate. Now I changed it and moved my PagerItems from the PagerTemplate to the CommandItemTemplate and now both, PDF export and paging are working.
Regards,
Jos.

i came accross the same problem because i am trying to export a custom Html Table under Radgrid. I used divs for this but then i got the error. do you have anything else in mind that could help me to export an Html Table under Radgrid.
Thanks in advance,
Eva Xanthou
​
Could you please sent the custom html which you are trying to export? This way I will test it on my end and if I am able to replicate the issue I would provide you with a solution for your case.
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.

<div style='display: table; width:100%'>
<div style= 'display: table-caption;text-align:center;font-weight: bold;font-size: larger;width:100%'>
<p>This is a Table</p>
</div>
<div style='display: table-row;font-weight: bold;text-align: center; width:100%'>
<div style='display: table-cell;width:35%'>
<p>Heading 1</p>
</div>
<div style='display: table-cell;width:30%'>
<p>Heading 2</p>
</div>
<div style='display: table-cell;width:35%'>
<p>Heading 3</p>
</div>
</div>
<div style='display: table-row;width:100%'>
<div style='display: table-cell;width:35%'>
<p>Row 1 Column 1</p>
</div>
<div style='display: table-cell;width:30%'>
<p>Row 1 Column 2</p>
</div>
<div style='display: table-cell;width:35%'>
<p>Row 1 Column 3</p>
</div>
</div>
<div style='display: table-row;width:100%'>
<div style='display: table-cell;width:35%'>
<p>Row 2 Column 1</p>
</div>
<div style='display: table-cell;width:30%'>
<p>Row 2 Column 2</p>
</div>
<div style='display: table-cell;width:35%'>
<p>Row 2 Column 3</p>
</div>
</div>
</div>
Note that you can not use a percentage to set the width of the table and the cells. You need to set width in pixels or another absolute units. Please examine the Exporting HTML tables from the following help article from more information.
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.

Thanks for your response. it helped me a lot.
i have another problem. when i write something in a td with greek characters when i export this i get "######"
do you have any idea????
thanks in advance,
Eva
Please try setting a Unicode font which supports international characters such as Arial Unicode MS. I would recommend you to examine the Fonts / Unicode support section of the following help article for more information.
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.