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

[Solved] Export to PDF

3 Answers 118 Views
Grid
This is a migrated thread and some comments may be shown as answers.
satya
Top achievements
Rank 1
satya asked on 20 Oct 2009, 02:05 PM

Hi,

I have requirement to create an PDF from RadGrid along with some additional information. The target requirement is something like below
I have a logo and some additional banners(Label/Images) in starting of the page followed by RadGrid and followed by other aditional banners(labels/Images). I want to export total all these three parts into PDF.

In simple words..I like to export total page as it is to PDF

Please give me the suggession. It is little urget for me

Thanks in advance.

Regards,
Satya





3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 20 Oct 2009, 02:45 PM
Hi Satya,

I would suggest you to use CommandItemTemplate for this purpose. You may include these details as a part of its content and set ExportSettings -> ExportOnlyData = false in the export button's click event. You can also refer the following help article which explains more about this. Go through the portion titled 'Including additional information as part of the exported document'.
Exporting tips and tricks

Princy.
0
satya
Top achievements
Rank 1
answered on 20 Oct 2009, 04:10 PM
Hi Princy,

Thank you very much for your reply.

I tried with it and   set CommandItemDisplay="Top" NOw i could able to set the my owned data as starting of the page followed by Grid.

NOw i want to include some additional information (copyright and other information at down).

How to include two commandItemTemplates which should be placed one at top and other at down?


Regards,
Satya
0
Princy
Top achievements
Rank 2
answered on 21 Oct 2009, 06:20 AM
Hello Satya,

You can display different controls inside the top/bottom command item by choosing the CommandItemDisplay="TopAndBottom" option. and thereby switching the visibility of the controls on ItemCreated. Thus, the required header and footer additional information can be exported using grid. Check out hte following code to understand how to get this done.
aspx:
 <telerik:RadGrid ID="RadGrid1" AutoGenerateColumns="False" AllowPaging="true"  PageSize="10" DataSourceID="SqlDataSource1" runat="server" onitemcreated="RadGrid1_ItemCreated">           
      <MasterTableView CommandItemDisplay="TopAndBottom" DataSourceID="SqlDataSource1"
           <CommandItemTemplate> 
             <asp:Panel ID="panel1" runat="server"
             [Additional Information part1] 
             </asp:Panel>              
             <asp:Panel ID="panel2" runat="server"
             [Additional Information part2] 
             </asp:Panel>              
           </CommandItemTemplate> 
                ...... 

c#:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridCommandItem) 
        { 
            GridCommandItem commandItem = (GridCommandItem)e.Item; 
            if (commandItem.NamingContainer is GridTHead) 
            { 
                commandItem.FindControl("panel2").Visible = false;                 
            } 
            else if (commandItem.NamingContainer is GridTFoot) 
            { 
                commandItem.FindControl("panel1").Visible = false;                
            } 
        } 
    } 

Thanks
Princy.
Tags
Grid
Asked by
satya
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
satya
Top achievements
Rank 1
Share this question
or