I have a TabStrip, and each tab has a RadGrid in it. They all have the same PDF export settings and the same code (only the columns and data source are different). But only the 1st grid works when I export to PDF. Is this a known issue that I can't export from multiple grids on the same page?
In the grids that don't work, when I click my Export To PDF button, the pager item and Export To PDF button disappears, and nothing happens.
Here is the code for one of the grids that doesn't export correctly - am I missing anything? I also tried adding MasterTableView.ExportToPDF() but that didn't make a difference, and the first grid on my page works without it.
In the grids that don't work, when I click my Export To PDF button, the pager item and Export To PDF button disappears, and nothing happens.
Here is the code for one of the grids that doesn't export correctly - am I missing anything? I also tried adding MasterTableView.ExportToPDF() but that didn't make a difference, and the first grid on my page works without it.
| <%@ Control Language="C#" AutoEventWireup="true" CodeFile="ProgramAssignmentGrid.ascx.cs" |
| Inherits="Admin_UserControls_RepImport_ProgramAssignmentGrid" %> |
| <%@ Register TagPrefix="telerik" Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" %> |
| <asp:UpdatePanel runat="server"> |
| <ContentTemplate> |
| <p runat="server" id="pCaption"> |
| </p> |
| <telerik:RadGrid ID="ProgramGrid" runat="server" BorderStyle="None" AllowSorting="true" |
| AutoGenerateColumns="false" EnableAJAX="True" EnableAJAXLoadingTemplate="true" |
| OnItemCommand="RadGrid1_ItemCommand"> |
| <ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true"> |
| <Pdf AllowAdd="false" AllowCopy="true" AllowModify="true" AllowPrinting="true" Author="Anonymous" |
| Keywords="None" PageBottomMargin="1in" PageLeftMargin="1in" PageRightMargin="1in" |
| PageTopMargin="1in" PageTitle="Rep Import - Program Assignments" Subject="Rep Import - Program Assignments" |
| Title="Rep Import - Program Assignments" PaperSize="Letter" /> |
| </ExportSettings> |
| <MasterTableView AutoGenerateColumns="false" PagerStyle-AlwaysVisible="true" Width="100%"> |
| <PagerTemplate> |
| <asp:LinkButton ID="ExportToPdfButton" runat="server" CommandName="ExportToPdf">Export to PDF</asp:LinkButton> |
| </PagerTemplate> |
| <Columns> |
| <telerik:GridBoundColumn HeaderText="Program" DataField="ProgramName" SortExpression="ProgramName"> |
| <HeaderStyle Width="50%" /> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn HeaderText="Territory" DataField="TerritoryName" SortExpression="TerritoryName"> |
| <HeaderStyle Width="45%" /> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn HeaderText="Budget" DataField="Budget" SortExpression="Budget"> |
| <HeaderStyle Width="10%" /> |
| </telerik:GridBoundColumn> |
| </Columns> |
| <PagerStyle BorderStyle="None" Position="Top" /> |
| </MasterTableView> |
| </telerik:RadGrid> |
| </ContentTemplate> |
| </asp:UpdatePanel> |
| public partial class Admin_UserControls_RepImport_ProgramAssignmentGrid : MillenniumUserControl |
| { |
| protected void Page_PreRender(object sender, EventArgs e) |
| { |
| Common.ApplyPdfExportStyles(ProgramGrid); |
| } |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| ProgramGrid.Skin = Common.GridSkin; |
| ProgramGrid.AllowPaging = this.AllowPaging; |
| ProgramGrid.ExportSettings.Pdf.Title += (" " + DateTime.Now.ToShortDateString()); |
| } |
| protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e) |
| { |
| if (e.CommandName == RadGrid.ExportToPdfCommandName) |
| { |
| RepImport import = Session["RepImport"] as RepImport; |
| if (import != null) |
| { |
| //add client name to page title |
| string clientName = Client.GetClientNameFromID(import.ClientID); |
| ProgramGrid.ExportSettings.FileName = "Rep Import Preview - Add Reps"; |
| ProgramGrid.ExportSettings.Pdf.PageTitle |
| = string.Format("Rep Import {0} - Add Reps for {1}", |
| DateTime.Now.ToShortDateString(), |
| clientName); |
| } |
| } |
| } |
| public RadGrid Grid |
| { |
| get { return ProgramGrid; } |
| } |
| public string Caption |
| { |
| get { return pCaption.InnerText; } |
| set { pCaption.InnerText = value; } |
| } |
| public bool AllowPaging |
| { |
| get { return allowPaging; } |
| set { allowPaging = value; } |
| } |
| private bool allowPaging = true; |
| } |