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

ExportToPDF Problem, with GridTemplateColumn

1 Answer 17 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Neil asked on 11 May 2012, 09:20 AM
Hi there,

I am trying to exportToPDF in a radgrid.   It seems to work fine except for a gridtemplatecolumn i have which contains another radgrid.

So basically, each row has a column which contains a grid containing a list of strings (they are validation msg's).  

I have found a few threads telling me to enable the viewstate for the grid, and also, to ExportOnlyData="false", which has no affect.

Everything else seems to work fine, except the exporting.

thanks in advance!


below is the code:
<telerik:RadGrid id="rgdListLicences"   runat="server" Width="100%"  OnNeedDataSource="rgdListLicences_NeedDataSource"  GridLines="None" Skin="eLicensing_paging"  EnableEmbeddedSkins="false" EnableViewState="true">
                     <ExportSettings IgnorePaging="true" OpenInNewWindow="true" ExportOnlyData="false"   >
                        <Pdf PageHeight="210mm" AllowPrinting="true"   PageWidth="297mm" PageTitle="Print Validations" DefaultFontFamily="Arial Unicode MS"
                        PageBottomMargin="20mm" PageTopMargin="20mm"  PageLeftMargin="20mm" PageRightMargin="20mm" />
                     <MasterTableView RetrieveAllDataFields="false" CommandItemDisplay="Top" AutoGenerateColumns="false"  >
                                <telerik:radbutton ID="DownloadPDF" AutoPostBack="true" CssClass="pdfButton" runat="server"  Width="10%" Text="Print Validations" CommandName="ExportToPdf"/>
                            <telerik:GridBoundColumn DataField="clientRef" DataFormatString="{0:dd/MM/yy}" HeaderText="Client Ref"><ItemStyle Width="12%" VerticalAlign="Top" />
                            <telerik:GridBoundColumn DataField="ServiceName" HeaderText="Service Name"><ItemStyle Width="28%" VerticalAlign="Top" />
                            <telerik:GridBoundColumn DataField="commencementDate" DataFormatString="{0:dd/MM/yy}" HeaderText="Start Date"><ItemStyle Width="12%"  VerticalAlign="Top" />
                            <telerik:GridTemplateColumn UniqueName="validations" HeaderText="Validations" SortExpression="CompanyName"  >
                                    <telerik:radgrid ID="rgdValidations"  OnNeedDataSource="rgdValidations_NeedDataSource" BorderStyle="None" ShowHeader="false" runat="server"  EnableViewState="true" >
                                            <ItemStyle Font-Size="Smaller" />
                                            <AlternatingItemStyle Font-Size="Smaller"/>

Protected Sub rgdValidations_NeedDataSource(ByVal sender As Object, ByVal e As GridNeedDataSourceEventArgs)
    Dim RadGrid2 As RadGrid = CType(sender, RadGrid)
    Dim item As GridDataItem = RadGrid2.NamingContainer
    Dim validations As List(Of String) = CType(item.DataItem, LicencesLicence).validations
    RadGrid2.DataSource = validations
End Sub

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 16 May 2012, 11:30 AM
Hello Neil,

Exporting nested RadGrids is tricky and may not work as you expected. I would recommend that you disable the IgnorePaging property.
Also you can examine the following code-library project.

Best regards,
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question