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

RadGrid is not Exporting Bound Sql Dataset to PDF

1 Answer 14 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ronald
Top achievements
Rank 1
Ronald asked on 31 Jul 2014, 06:43 PM
I have a RadGrid that retrieve data on button click via Sql using a repository pattern.  When the downloadPDF button is used the PDF only display the header info.  The remainder of the pdf page is blank.   Below are my codes.  Your help is greatly appreciated.
<head runat="server">
 
 <title>Trader Position</title>
 
 <link href="../Content/CotUI.css" rel="stylesheet" />
 
 <script type="text/javascript">
  
 function requestStart(sender, args) {
 
 if (args.get_eventTarget().indexOf("DownloadPDF") > 0)
 
 args.set_enableAjax(false);
 
}
 
 </script>
  
</head>
<body>
 <form id="form1" runat="server">
 
<telerik:RadScriptManager ID="RadScriptManager1" runat="server" AsyncPostBackTimeout="900"></telerik:RadScriptManager>
<div>
 
<asp:Button ID="ViewDataButton" runat="server" Text="View Trader Data" CssClass="blu-btn" ToolTip="Click to View Trader Data" OnClick="ViewDataButton_Click" />
</div>
<br />
 
<div id="TradersPositionDataGrid">
 
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Black">
 
</telerik:RadAjaxLoadingPanel>
 
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" ClientEvents-OnRequestStart="requestStart" DefaultLoadingPanelID="RadAjaxLoadingPanel1" UpdatePanelsRenderMode="Inline">
 
<AjaxSettings>
 
<telerik:AjaxSetting AjaxControlID="ViewDataButton">
 
<UpdatedControls>
 
<telerik:AjaxUpdatedControl ControlID="TraderRadGrid" ></telerik:AjaxUpdatedControl>
 
</UpdatedControls>
 
</telerik:AjaxSetting>
 
</AjaxSettings>
 
</telerik:RadAjaxManager>
 
<asp:ImageButton ID="DownloadPDF" runat="server" ImageUrl="~/Images/pdf-icon.png" OnClick="DownloadPDF_Click" />
 
<telerik:RadGrid ID="TraderRadGrid" runat="server" PageSize="500" AutoGenerateColumns="false" AllowPaging="true" Width="1100"
 
OnUpdateCommand="TraderRadGrid_UpdateCommand" OnItemCreated="TraderRadGrid_ItemCreated" >
 
<ExportSettings IgnorePaging="true" OpenInNewWindow="true" HideStructureColumns="true" >
 
<Pdf PageHeight="210mm" PageWidth="297mm" DefaultFontFamily="Arial Unicode MS" PageTopMargin="45mm"
 
BorderStyle="Medium" BorderColor="#666666">
 
</Pdf>
 
</ExportSettings>
 
<ClientSettings>
 
 <%--<Scrolling AllowScroll="true" UseStaticHeaders="true"></Scrolling>--%>
 
 <%--<Scrolling AllowScroll="false" UseStaticHeaders="false"></Scrolling>--%>
 
<Virtualization ItemsPerView="500" EnableVirtualization="true" EnableCurrentPageScrollOnly="true" InitiallyCachedItemsCount="2000" />
 
<Resizing AllowColumnResize="true" />
 
</ClientSettings>
 
<MasterTableView EditMode="InPlace" EnableNoRecordsTemplate="true" CommandItemDisplay="Top" AutoGenerateColumns="false" DataKeyNames="OWNER_ID">
 
<CommandItemSettings ShowAddNewRecordButton="false" />
 
<ColumnGroups>
 
<telerik:GridColumnGroup HeaderText="Futures" Name="FuturesInfo" HeaderStyle-HorizontalAlign="Center"></telerik:GridColumnGroup>
 
<telerik:GridColumnGroup HeaderText="Adjusted Options" Name="AdjOptionInfo" HeaderStyle-HorizontalAlign="Center"></telerik:GridColumnGroup>
 
</ColumnGroups>
 
<Columns>
 
<telerik:GridEditCommandColumn ButtonType="ImageButton"></telerik:GridEditCommandColumn>
 
<telerik:GridBoundColumn UniqueName="TraderId" DataField="OWNER_ID" HeaderText="Trader Id"></telerik:GridBoundColumn>
 
<telerik:GridBoundColumn UniqueName="TraderName" DataField="TRADER_NAME" HeaderText="Trader Name"></telerik:GridBoundColumn>
 
<telerik:GridBoundColumn UniqueName="ContractMarket" DataField="CONTRACT_MARKET_CODE" HeaderText="Contract Market"></telerik:GridBoundColumn>
 
<telerik:GridBoundColumn UniqueName="ExpirationDate" DataField="FUTURES_EXPIRATION_DATE" HeaderText="Expiration Date"></telerik:GridBoundColumn>
 
<telerik:GridBoundColumn UniqueName="FutureLong" DataField="FUT_LONG" HeaderText="Future Long" ColumnGroupName="FuturesInfo"></telerik:GridBoundColumn>
 
<telerik:GridBoundColumn UniqueName="FutureShort" DataField="FUT_SHORT" HeaderText="Future Short" ColumnGroupName="FuturesInfo"></telerik:GridBoundColumn>
 
<telerik:GridBoundColumn UniqueName="AdjOptionLong" DataField="ADJ_OPT_LONG" HeaderText="Adjusted Option Long" ColumnGroupName="AdjOptionInfo"></telerik:GridBoundColumn>
 
<telerik:GridBoundColumn UniqueName="AdjOptionShort" DataField="ADJ_OPT_SHORT" HeaderText="Adjusted Option Short" ColumnGroupName="AdjOptionInfo"></telerik:GridBoundColumn>
 
<telerik:GridBoundColumn UniqueName="CommercialFlag" DataField="COMMERCIAL_FLAG" HeaderText="Commercial Flag"></telerik:GridBoundColumn>
 
</Columns>
 
<EditFormSettings EditColumn-HeaderStyle-Width="50px">
 
<EditColumn ButtonType="ImageButton" />
 
</EditFormSettings>
 
</MasterTableView>
 
<PagerStyle AlwaysVisible="true" Mode="NextPrev"></PagerStyle>
 
</telerik:RadGrid>
 
</div>
 
</form>
 
</body>
 
</html>

 

 

bool isPdfExport = false;
 
        protected void DownloadPDF_Click(object sender, ImageClickEventArgs e)
        {
             
             
            isPdfExport = true;
            //TraderRadGrid.Rebind();
            //TraderRadGrid.MasterTableView.Rebind();      
            TraderRadGrid.MasterTableView.ExportToPdf();
             
        }

 

Again Thank You.

 

 

 













 

 

 


1 Answer, 1 is accepted

Sort by
0
Ronald
Top achievements
Rank 1
answered on 31 Jul 2014, 07:52 PM
I discovered my own solution.  In the DownloadPDF button click event I added the below line of code.

TraderRadGrid.ClientSettings.Virtualization.EnableVirtualization = false;

Hope this help someone else.

Tags
Grid
Asked by
Ronald
Top achievements
Rank 1
Answers by
Ronald
Top achievements
Rank 1
Share this question
or