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

[Solved] RadGrid ExporttoPDF formatting problem

3 Answers 204 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mazhar Islam
Top achievements
Rank 1
Mazhar Islam asked on 08 Jul 2009, 07:02 AM
I have two radgrid inside another radgrid and the aspx file code is below. I can show the grid properly but problem is when I am exporting the master grid into PDF it is not formatting properly. I know that the CSS doesn't work at PDFExporting but how can I show the Grid Lines properly. It I tried with different setting of the GridLines= "None" but seems it doesn't work.
Also, i used <br /> for a new line and it aspx page it is working fine but in the PDF export it doesn't work properly.
Plaese help me.

 

 

<telerik:RadGrid ID="RadGridWrapper" runat="server" GridLines= "None" ShowHeader="false" BorderStyle="None" style="background-color: Transparent; " Width="550px" >

 

 

<ExportSettings ExportOnlyData="false" OpenInNewWindow="true">

 

 

 

<Pdf PageHeight="297mm" PageWidth="180mm" PageTitle="Email Statistics" />

 

 

 

</ExportSettings>

 

 

 

<MasterTableView AutoGenerateColumns="true" >

 

 

 

<ItemTemplate>

 

 

 

<br />

 

 

 

<asp:Label ID="LabelMessageName" runat="server" Font-Bold="true" Font-Size= "Small" ></asp:Label><br />

 

 

 

<b>Email Stats</b><br />

 

 

 

<telerik:RadGrid ID="RadGridEmailStats" runat="server" GridLines= "None" AllowPaging="True" AllowSorting="True"

 

 

AutoGenerateColumns="False" CssClass="Grid" >

 

<ExportSettings ExportOnlyData="false" OpenInNewWindow="true" />

 

<MasterTableView>

 

 

<Columns>

 

 

<telerik:GridBoundColumn HeaderText="Tracking Item" DataField="TrackingItem" SortExpression="TItem"

 

 

HeaderStyle-HorizontalAlign="Center" >

 

 

<ItemStyle HorizontalAlign= "Left" />

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn HeaderText="Count" DataField="Count" SortExpression="Count"

 

 

HeaderStyle-HorizontalAlign= "Center" >

 

<ItemStyle HorizontalAlign= "Right" />

 

</telerik:GridBoundColumn>

 

 

</Columns>

 

 

</MasterTableView>

 

 

</telerik:RadGrid>

 

 

<br />

 

 

<asp:Label ID="LabelDailyBreakdown" runat="server">Daily Breakdown</asp:Label>

 

 

<asp:Label ID="Label1" runat="server" Text=" "></asp:Label>

 

 

<br />

 

 

<telerik:RadGrid ID="RadGridBreakdown" runat="server" GridLines= "None" AllowPaging="True" AllowSorting="True"

 

 

AutoGenerateColumns="False" OnItemDataBound="RadGridBreakdown_ItemDataBound"

 

 

CssClass="Grid">

 

 

<ExportSettings ExportOnlyData="false" OpenInNewWindow="true" />

 

 

<MasterTableView>

 

 

<RowIndicatorColumn>

 

 

<HeaderStyle Width="20px" />

 

 

</RowIndicatorColumn>

 

 

<ExpandCollapseColumn>

 

 

<HeaderStyle Width="20px" />

 

 

</ExpandCollapseColumn>

 

 

<Columns>

 

 

<telerik:GridBoundColumn HeaderText="DateCreated" DataField="DATE_CREATED" UniqueName="DATE_CREATED" SortExpression="DATE_CREATED" Visible="True" />

 

 

<telerik:GridBoundColumn HeaderText="Opened" UniqueName="MailOpened" Reorderable="False" HeaderStyle-HorizontalAlign="Center" SortExpression="MOpened" >

 

 

<ItemStyle HorizontalAlign= "Right" />

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn HeaderText="Hits" UniqueName="LinkHits" Reorderable="False" HeaderStyle-HorizontalAlign="Center"

 

 

SortExpression="LHits" >

 

 

<ItemStyle HorizontalAlign= "Right" />

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn HeaderText="Opened" DataField="OPENED" Visible="False" />

 

 

<telerik:GridBoundColumn HeaderText="Unique Open" DataField="UNIQUE_OPENED" Visible="False" />

 

 

<telerik:GridBoundColumn HeaderText="Hits" DataField="HITS" Visible="False" />

 

 

<telerik:GridBoundColumn HeaderText="Unique Hits" DataField="UNIQUE_HITS" Visible="False" />

 

 

</Columns>

 

 

</MasterTableView>

 

 

</telerik:RadGrid>

 

 

</ItemTemplate>

 

 

</MasterTableView>

 

 

</telerik:RadGrid>

 

 

 


3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 08 Jul 2009, 09:18 AM
Hello Mazhar,

I recommend you examine the following links.
Export to PDF online demo
Exporting tips and tricks
Export to Microsoft Excel/Word/PDF/CSV

Let me know if you have any questions.

Best regards,
Daniel
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.
0
Mazhar Islam
Top achievements
Rank 1
answered on 08 Jul 2009, 12:56 PM
Hi Daniel,
Thanks for your reply. 
Could you please tell me how can I manage the GridLines? I used nested Grid and I don't need any Gridlines for the parent Grid, also I need a line break between two child grids.
Regards,
M
0
Daniel
Telerik team
answered on 08 Jul 2009, 03:22 PM
Hello Mazhar,

Straight onto your questions:
"Could you please tell me how can I manage the GridLines? I used nested Grid and I don't need any Gridlines for the parent Grid,"
To remove all lines you should set BorderWidth="0" on both RadGrid and MasterTableView.

"also I need a line break between two child grids."
A possible approach is demonstrated below:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) 
    if (e.Item is GridHeaderItem && e.Item.OwnerTableView.Name == "myDetailTable" && isPdfExport) 
    { 
        foreach(TableCell cell in e.Item.Cells) 
            cell.Style["padding-top"] = "200px"
    } 

Regards,
Daniel
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.
Tags
Grid
Asked by
Mazhar Islam
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Mazhar Islam
Top achievements
Rank 1
Share this question
or