This is a migrated thread and some comments may be shown as answers.
PDFExport Error
1 Answer 65 Views
This is a migrated thread and some comments may be shown as answers.
John John
Top achievements
Rank 1
John John asked on 31 Mar 2010, 04:21 PM
Hi,
      I am trying to export one of the Nested grid which is shown when expanding the parent grid meanwhile I am getting the following error 

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.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)

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: System.SystemException: 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.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)

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SystemException: 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.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)]
   Telerik.Web.Apoc.ApocDriver.FireApocError(String message) +122
   Telerik.Web.Apoc.Fo.FOTreeBuilder.Parse(XmlReader reader) +951
   Telerik.Web.Apoc.ApocDriver.Render(XmlReader inputReader, Stream outputStream) +293
   Telerik.Web.Apoc.ApocDriver.Render(TextReader inputReader, Stream outputStream) +61
   Telerik.Web.UI.Grid.Export.TableViewExporter.PdfExportRenderForm(HtmlTextWriter nullWriter, Control form) +2018
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +256
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
   System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +8673113
   System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +32
   System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +51
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
   System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +40
   Telerik.Web.UI.Grid.Export.TableViewExporter.PdfExportRenderPage(HtmlTextWriter nullWriter, Control page) +161
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +256
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
   System.Web.UI.Page.Render(HtmlTextWriter writer) +29
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   Telerik.Web.UI.RadAjaxControl.RenderPageInAjaxMode(HtmlTextWriter writer, Control page) +825
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +256
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
   System.Web.UI.Page.Render(HtmlTextWriter writer) +29
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1266

I tested with only one column in my nested grid, eventhough i am getting the error.
<telerik:RadGrid ID="RadCustomer" runat="server"   
                                        AutoGenerateColumns="false" AllowSorting="true" Skin="Vista" EnableLinqExpressions="false" 
                                        Width="100%"  OnItemDataBound="RadCustomer_ItemDataBound" OnNeedDataSource="RadCustomer_NeedDataSource" OnItemCreated="RadCustomer_ItemCreated" OnItemCommand="RadCustomer_ItemCommand">  
                                        <ExportSettings IgnorePaging="True" OpenInNewWindow="True">  
                                            <Pdf AllowCopy="True" PageTitle="PostingNotice Billing Report" Keywords="None" Subject="RadGrid Export" 
                                                Author="Anonymous" PageHeight="8.5in" PageWidth="14in" Title="PostingNotice Billing Report" /> 
                                        </ExportSettings> 
                                        <PagerStyle Mode="NumericPages"></PagerStyle> 
                                        <SortingSettings EnableSkinSortStyles="false" />                                          
                                        <ClientSettings AllowColumnHide="True" AllowRowHide="True" AllowColumnsReorder="True" 
                                            ReorderColumnsOnClient="True">  
                                            <Resizing EnableRealTimeResize="True" ResizeGridOnColumnResize="True" AllowColumnResize="true" 
                                                ClipCellContentOnResize="false"></Resizing> 
                                        </ClientSettings> 
                                        <MasterTableView TableLayout="Fixed" Name="Forms" GroupLoadMode="Client" EnableHeaderContextMenu="true" 
                                            AllowSorting="true" AllowMultiColumnSorting="True" AllowCustomSorting="false" CommandItemDisplay="Top">  
                                            <HeaderStyle CssClass="HeaderStyle" /> 
                                            <%--<ItemStyle CssClass="ItemStyle" /> 
                                            <AlternatingItemStyle CssClass="AlternatingItemStyle" />--%> 
                                            <NoRecordsTemplate> 
                                                <div style="background-color: Silver; height: 20px; color: Red; text-align: center;  
                                                    font-size: 10pt; font-family: Verdana; font-weight: bold;"> 
                                                    <i>No forms defined for this application.</i> 
                                                </div> 
                                            </NoRecordsTemplate> 
                                            <CommandItemTemplate> 
                                                <table width="100%" class="RadCommandTable" style="padding: 0px;">  
                                                    <tr> 
                                                        <td align="center">  
                                                            <asp:Button ID="btnFormsExport" CommandName="lnkFormsExport" runat="server" Text="FExport" /> 
                                                        </td> 
                                                    </tr> 
                                                </table> 
                                            </CommandItemTemplate> 
                                            <Columns>                        
                                              
                                                <telerik:GridTemplateColumn HeaderText="Jurisdiction" SortExpression="Name" 
                                                    DataField="Name" GroupByExpression="Name Group By Name" 
                                                    UniqueName="Jurisdiction">  
                                                    <ItemTemplate> 
                                                        <asp:Label ToolTip='<%# Eval("Name") %>' Text='<%# Eval("Name") %>' ID="lblJuris" runat="server"></asp:Label> 
                                                    </ItemTemplate> 
                                                </telerik:GridTemplateColumn>                                                                                            
                                                                                                                                             
                                            </Columns> 
                                        </MasterTableView> 
                                     </telerik:RadGrid> 

My CS code is
 protected void RadCustomer_ItemCommand(object source, GridCommandEventArgs e)  
    {  
        RadGrid selGrid = (RadGrid)source;  
        if (e.Item is GridCommandItem)  
        {  
            //ExportPDF button clicks  
            if (e.CommandName == "lnkCustExport")  
            {  
                //Setting the PDF flag to true  
                isPdfExport = true;  
                ConfigureSelectFormsPDFExport(selGrid);  
                selGrid.MasterTableView.ExportToPdf();  
                e.Item.OwnerTableView.Rebind();  
            }  
        } 
So guide me to solve the issue

-Thanks

1 Answer, 1 is accepted

Sort by
0
Bruno
Top achievements
Rank 2
answered on 31 Mar 2010, 08:17 PM
Hi

this is Bruno... I have noticed this error here:http://www.telerik.com/help/aspnet-ajax/grid-pdf-export.html

thank
Tags
Grid
Asked by
John John
Top achievements
Rank 1
Answers by
Bruno
Top achievements
Rank 2
Share this question
or