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

[Solved] Export PDF

2 Answers 144 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 21 May 2009, 08:56 PM

I am trying to export a PDF file but it does nothing when I click the button.  I put the image inside the CommandDisplay area b/c that is where the customer wants it.  Any help would be greatly appreciated.

    <MasterTableView .... CommandItemDisplay="Top">  
        <CommandItemTemplate>                                       
            <asp:ImageButton ID="btnPDF" runat="server" ImageUrl="~/Images/Pdf.png" OnClick="btnPDF_Click" />
        </CommandItemTemplate>
       
        protected void btnPDF_Click(object sender, ImageClickEventArgs e)
        {
            ConfigureExport();
            rgrdData.MasterTableView.ExportToPdf();
        }

        public void ConfigureExport()
        {
            rgrdData.ExportSettings.ExportOnlyData = true;
            rgrdData.ExportSettings.IgnorePaging = true;
            rgrdData.ExportSettings.OpenInNewWindow = true;
           
        }       

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 22 May 2009, 04:03 AM
Hi Robert,

Have you ajaxified the Grid? If so go through the following help article which explains how to export from a Grid with Ajax enabled.
Export from ajaxified grid

Thanks
Shinu.
0
Daniel
Telerik team
answered on 22 May 2009, 07:04 AM
Hello Robert,

In addition to the previous post:

When exporting images in CommandItem you should call the PrepareItemStyle method.
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) 
   if (e.Item is GridCommandItem) 
   { 
      e.Item.PrepareItemStyle();            
   } 

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
Robert
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Daniel
Telerik team
Share this question
or