Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Grid > PDF Export, Apoc Layout block area, no Divs used
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

Not answered PDF Export, Apoc Layout block area, no Divs used

Feed from this thread
  • Christian avatar

    Posted on Apr 7, 2011 (permalink)

    Ajax 2010.3.1317.35

    I have some problems getting the pdf export functioning, i read in the documentation that the error is thrown when Divs inside the grid has positions declared or uses absolute positions, i have neither of those and still get,

    System.InvalidCastException: Unable to cast object of type 'Telerik.Web.Apoc.Layout.BlockArea' to type 'Telerik.Web.Apoc.Layout.AreaContainer'.

    Has anyone come across this, could it be the editor thats rendered as a Div element? on load, all editors are set to disabled.

    Here´s my grid

    <telerik:RadGrid ID="grNotes" runat="server" AutoGenerateColumns="False" 
            GridLines="None" ShowHeader="False" 
            onitemdatabound="grNotes_ItemDataBound" Width="1012px">
    <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
      
    <MasterTableView>
    <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
      
    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
    <HeaderStyle Width="20px"></HeaderStyle>
    </RowIndicatorColumn>
      
    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
    <HeaderStyle Width="20px"></HeaderStyle>
    </ExpandCollapseColumn>
      
        <Columns>
            <telerik:GridTemplateColumn FilterControlAltText="Filter tcInfo column" 
                UniqueName="tcInfo">
                <ItemTemplate>
                    <asp:Label ID="labName" runat="server" 
                        Text='<%# Eval("nt_us_id") %>'></asp:Label>
                    <br />
                    <asp:Label ID="labTimePosted" runat="server" Text="Label"></asp:Label>
                    <br />
                    <asp:Image ID="imgAttechment" runat="server" 
                        ImageUrl="~/images/fileIcon2.png" />
                    <asp:Image ID="imgMail" runat="server" ImageUrl="~/images/mailIcon.png" />
                    <asp:Label ID="noteID" runat="server"></asp:Label>
                </ItemTemplate>
                <HeaderStyle Width="150px" />
                <ItemStyle Width="150px" />
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn FilterControlAltText="Filter tcNote column" 
                UniqueName="tcNote">
                <ItemTemplate>
                    <telerik:RadEditor ID="edNoteText" runat="server" EditModes="Design" CssClass="text" 
                                        Skin="Sitefinity" ToolsFile="~/BasicSetOfTools.xml" Width="100%" ContentAreaCssFile="EditorContentCSS.css">
                                        <CssFiles>
                                            <telerik:EditorCssFile Value="EditorCSS.css" />
                                        </CssFiles>
                                <imagemanager deletepaths="~/images/NotiserTextEditor" 
                                            searchpatterns="*.jpg,*.jpeg,*.gif,*.png" uploadpaths="~/images/NotiserTextEditor" 
                                            viewpaths="~/images/NotiserTextEditor" />
                                        <Content>
    </Content>
                                    </telerik:RadEditor>
                </ItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn FilterControlAltText="Filter tcButtons column" 
                UniqueName="tcButtons">
                <ItemTemplate>
                    <asp:ImageButton ID="imgEdit" runat="server" ImageUrl="~/images/editIcon.png" 
                        onclick="imgEdit_Click" />
                    <br />
                    <asp:ImageButton ID="imgHide" runat="server" 
                        ImageUrl="~/images/visibleIcon.png" onclick="imgHide_Click" />
                    <br />
                    <asp:ImageButton ID="imgDelete" runat="server" 
                        ImageUrl="~/images/deleteIcon.png" onclick="imgDelete_Click" />
                    <br />
                    <asp:ImageButton ID="imgSave" runat="server" ImageUrl="~/images/saveIcon.png" 
                        onclick="imgSave_Click" />
                    <br />
                    <asp:ImageButton ID="imgCancel" runat="server" 
                        ImageUrl="~/images/cancelIcon.png" onclick="imgCancel_Click" />
                </ItemTemplate>
                <HeaderStyle Width="30px" />
                <ItemStyle Width="30px" />
            </telerik:GridTemplateColumn>
        </Columns>
      
    <EditFormSettings>
    <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
    </EditFormSettings>
    </MasterTableView>
      
    <FilterMenu EnableImageSprites="False"></FilterMenu>
        </telerik:RadGrid>

  • Daniel Daniel admin's avatar

    Posted on Apr 12, 2011 (permalink)

    Hello Christian,

    I recommend that you try to temporary comment out RadEditor to see whether it is the cause of this error.

    Kind regards,
    Daniel
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  • Christian avatar

    Posted on May 4, 2011 (permalink)


    Sorry for the late responce, i had to put this aside for a while.
    I tried to disable the editor as you mentioned but it gave me the same result.

    i had a look at the generated code inside the grid, and as i understand the error is thrown as soon as i have a div with size specified, but how would one set the grid size that generate a div and still get the exporting to function?

    this is the generated code (grid),

    <div id="ctl00_phContent_grNotes" class="RadGrid RadGrid_Default" style="width:1012px;">
      
    <table cellspacing="0" class="rgMasterTable" border="0" id="ctl00_phContent_grNotes_ctl00" style="width:100%;table-layout:auto;empty-cells:show;">
        <colgroup>
            <col style="width:150px" />
            <col  />
            <col style="width:30px" />
        </colgroup>
    <thead>
            <tr style="display:none;">
                <th scope="col"> </th><th scope="col"> </th><th scope="col"> </th>
            </tr>
        </thead><tbody>
        <tr class="rgRow" id="ctl00_phContent_grNotes_ctl00__0">
            <td style="width:150px;">
                    <span id="ctl00_phContent_grNotes_ctl00_ctl04_labName">Nilsson, Anna</span>
                    <br />
                    <span id="ctl00_phContent_grNotes_ctl00_ctl04_labTimePosted">2011-05-04 07:53</span>
                    <br />
                      
                      
                    <span id="ctl00_phContent_grNotes_ctl00_ctl04_noteID" style="visibility:hidden">65</span>
                </td><td>
                    <div id="ctl00_phContent_grNotes_ctl00_ctl04_edNoteText" class="text" style="width:785px;">
                Sofie Wetterbrandt ska hjälpa till med div jobb eftersom jag för tillfället är fullspäckad med arbete inför 70-års jubileum. Hon behöver: ATIVA, MONITOR, MAIL SAMT PROGRAM FÖR ATT KUNNA JOBBA HEMIFRÅN. Hon har jobbat här innan så hon bör redan ett mailkonto. Detta är brådskande och uppskattar om ni gör det så snart som möjligt!
            </div>
                </td><td style="width:30px;">
                    <input type="image" name="ctl00$phContent$grNotes$ctl00$ctl04$imgEdit" id="ctl00_phContent_grNotes_ctl00_ctl04_imgEdit" src="images/editIcon.png" style="border-width:0px;" />
                    <br />
                    <input type="image" name="ctl00$phContent$grNotes$ctl00$ctl04$imgHide" id="ctl00_phContent_grNotes_ctl00_ctl04_imgHide" src="/helpdeskg2/images/visibleIcon.png" style="border-width:0px;" />
                    <br />
                    <input type="image" name="ctl00$phContent$grNotes$ctl00$ctl04$imgDelete" id="ctl00_phContent_grNotes_ctl00_ctl04_imgDelete" src="images/deleteIcon.png" style="border-width:0px;" />
                    <br />
                      
                    <br />
                      
                </td>
        </tr>
        </tbody>
      
    </table><input id="ctl00_phContent_grNotes_ClientState" name="ctl00_phContent_grNotes_ClientState" type="hidden" />
        </div>

    as you can see all divs that has a size specified are generated by the grid, then i have some table and td sizes but the error states divs as a problem, as mentioned here,
    http://www.telerik.com/help/aspnet-ajax/grid-pdf-export.html

  • Daniel Daniel admin's avatar

    Posted on May 6, 2011 (permalink)

    Hello Christian,

    You can remove the widths of the DIV elements programmatically in the PdfExporting event.
    In the meantime we will do our best to address this issue for the next official version of RadControls for ASP.NET AJAX.

    Best regards,
    Daniel
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  • Christian avatar

    Posted on Jun 8, 2011 (permalink)

    Hi,

     


    It’s been a month since my inquiry about the issue of PDF exporting from the grid and my client is getting frustrated since they can’t use the solution due to this. I admit I haven’t tried any bigger workarounds since you mentioned it would be resolved in your upcoming release, but the latest versions all have the same issue i´m afraid.

     

    Is there any solution I can try that you are curtain will help, or to put it different, you must know what causes this in my case?

     

     


    Best regards

    Christian Persson

    Netred AB

  • Daniel Daniel admin's avatar

    Posted on Jun 13, 2011 (permalink)

    Hello Christian,

    I made a simple demo that shows how to hide the control and replace it with regular literal. Please test it locally and let me know whether this way is suitable for you.

    Regards,
    Daniel
    the Telerik team

    Consider using RadControls for ASP.NET AJAX (built on top of the ASP.NET AJAX framework) as a replacement for the Telerik ASP.NET Classic controls, See the product support lifecycle here.

    Attached files

  • Christian avatar

    Posted on Jun 17, 2011 (permalink)

    I tried the code in your sample but I still get,

    System.InvalidCastException: Det gick inte att omvandla ett objekt av typen Telerik.Web.Apoc.Layout.BlockArea till typen Telerik.Web.Apoc.Layout.AreaContainer.

    In English it says, cannot convert object of type Telerik.Web.Apoc.Layout.BlockArea to Telerik.Web.Apoc.Layout.AreaContainer

    The good (or bad depending on how you see it) news is that it works as soon as i set the editor to Visible=false so its most certain has something to do with the rendering of the Editor.
     

  • Christian avatar

    Posted on Jun 17, 2011 (permalink)

    Had another look at it for a few minutes and i saw that you use the built in itemcommand for exporting the pdf file, while our project uses an external linkbutten to call the ExportToPdf function, does this affect the ItemCreated event and "isPdgExport"? the event is fired but
    isPdgExport is always False.

    Tried to activate the built in pdf export function but isPdgExport is still False, however it dousent return a error, but instead just does a postback.

    any clues?

  • Daniel Daniel admin's avatar

    Posted on Jun 22, 2011 (permalink)

    Hello Christian,

    I made some modifications to the demo. It works with external button now. Please try it at your side and let me know what happens.

    Regards,
    Daniel
    the Telerik team

    Consider using RadControls for ASP.NET AJAX (built on top of the ASP.NET AJAX framework) as a replacement for the Telerik ASP.NET Classic controls, See the product support lifecycle here.

    Attached files

  • Christian avatar

    Posted on Jun 23, 2011 (permalink)

    Hello again Daniel,

    We need to do some more debugging next week as the editor content still is missing from the exported pdf, the editor is hidden but your code should add it to a literal but this dousent happen for some reasen, therefor we need to do a debug of the issue before i can give you any more information and we have a Swedish holiday coming up tomorrow.

    I just wanted to inform you that If we oversee the issue that the editor content still isent there, the last code snippet worked great, thank you, really appreceate it.

    If you get any ideas on why the content is missing dont hesitate to write a post as i can test it today but unable to do any debugging (AD integration in the project only allows me to copy local files to the customer server who dont have VS avalible)

    Best regards
    Christian

  • Christian avatar

    Posted on Jun 23, 2011 (permalink)

    Update,

    seems to be a postback issue at my end where the editor content is null or emtpy, when running the following code i got "testtest2" as a exported literal. like I mentiened before, we need to do some debugging but Im certain we will sort it it out, thanks again.
    RadEditor editor = e.Item.FindControl("edNoteText") as RadEditor;
    if (editor != null)
    {
    string content = editor.Content;
    editor.Visible = false;
    Literal lit = new Literal();
    lit.Text = "test" + content + "test2";
    editor.Parent.Controls.Add(lit);
    }

  • Daniel Daniel admin's avatar

    Posted on Jun 28, 2011 (permalink)

    Hello Christian,

    Please take your time. When you have more information just post it here, in this thread. In the meantime we are working on a possible solution for the div-related problem.

    Best regards,
    Daniel
    the Telerik team

    Consider using RadControls for ASP.NET AJAX (built on top of the ASP.NET AJAX framework) as a replacement for the Telerik ASP.NET Classic controls, See the product support lifecycle here.

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Grid > PDF Export, Apoc Layout block area, no Divs used