This is a migrated thread and some comments may be shown as answers.

RadGrid with custom css throws exeption if exporting to Pdf

2 Answers 81 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joffrey
Top achievements
Rank 2
Joffrey asked on 15 Aug 2008, 01:08 PM

Hi there

I have a RadGrid and if i want to export it to Pdf it throws the following error:

[SystemException: System.InvalidCastException: Das Objekt des Typs Telerik.Web.Apoc.Layout.BlockArea kann nicht in Typ Telerik.Web.Apoc.Layout.AreaContainer umgewandelt werden.
   bei Telerik.Web.Apoc.Fo.Flow.BlockContainer.Layout(Area area)
   bei Telerik.Web.Apoc.Fo.Flow.Block.Layout(Area area)
   bei Telerik.Web.Apoc.Fo.Flow.TableCell.Layout(Area area)
   bei Telerik.Web.Apoc.Fo.Flow.TableRow.Layout(Area area)
   bei Telerik.Web.Apoc.Fo.Flow.AbstractTableBody.Layout(Area area)
   bei Telerik.Web.Apoc.Fo.Flow.Table.Layout(Area area)
   bei Telerik.Web.Apoc.Fo.Flow.Block.Layout(Area area)
   bei Telerik.Web.Apoc.Fo.Flow.Flow.Layout(Area area, Region region)
   bei Telerik.Web.Apoc.Fo.Flow.Flow.Layout(Area area)
   bei Telerik.Web.Apoc.Fo.Pagination.PageSequence.Format(AreaTree areaTree)
   bei Telerik.Web.Apoc.StreamRenderer.Render(PageSequence pageSequence)
   bei Telerik.Web.Apoc.Fo.FOTreeBuilder.EndElement()
   bei Telerik.Web.Apoc.Fo.FOTreeBuilder.Parse(XmlReader reader)]
   Telerik.Web.Apoc.ApocDriver.FireApocError(String message) +100
   Telerik.Web.Apoc.Fo.FOTreeBuilder.Parse(XmlReader reader) +713


I use the following code in my aspx (this is only the relevant part):
(This gives me a nice dropshadow around the image, and it works...)

<telerik:GridTemplateColumn UniqueName="TemplateColumn1">  
                    <ItemTemplate> 
                        <div style="width:240px; padding:0 0 0 10px;">  
                            <div style="float:left;  
                                        background: url(../Images/shadowAlpha.png) no-repeat bottom right !important;   
                                        background: url(../Images/shadow.gif) no-repeat bottom right;   
                                        margin: 10px 0 0 10px !important;   
                                        margin: 10px 0 0 5px;"> 
                                <img style="display: block;  
                                            position: relative;  
                                           background-color: #fff;  
                                          border: 1px solid #a9a9a9;  
                                          margin: -6px 6px 6px -6px;  
                                          padding: 4px;" src="../Images/Newhaven.jpg" alt="test"/>  
                            </div> 
                        </div> 
                    </ItemTemplate> 
                    <HeaderStyle Width="10px" /> 
                </telerik:GridTemplateColumn> 

I drilled the error down to the first div (line 3), if I remove the "width" style-attribute the exportToPdf() works. The problem is that I cant remove the width because of "float:left". If removed it doesnt show the dropshadow propperly.

Does anyone know a solution to this problem?

Thanks
Joffrey

2 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 19 Aug 2008, 08:53 AM
Hi Joffrey,

I created a simple web page, using your code, but I did not receive the specified error. Can you send the complete page?

Kind regards,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Joffrey
Top achievements
Rank 2
answered on 21 Aug 2008, 06:33 AM
Hi Dimo

I solved the problem myself. After playing around a bit I found a solution.
I had to remove the width:240px; that was causing the error.
But then I had to edit the Itemstyle itself:

<

ItemStyle Width="240px" />

Now it works perfectly.

If you still want the whole page, I can post it nevertheless.
Thanks for your efforts
Joffrey

Tags
Grid
Asked by
Joffrey
Top achievements
Rank 2
Answers by
Dimo
Telerik team
Joffrey
Top achievements
Rank 2
Share this question
or