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

ExportToPDF Problem, with GridTemplateColumn

1 Answer 50 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Neil
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!

Neil

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" />
                     </ExportSettings>
                     <MasterTableView RetrieveAllDataFields="false" CommandItemDisplay="Top" AutoGenerateColumns="false"  >
                        <CommandItemTemplate>
                                <telerik:radbutton ID="DownloadPDF" AutoPostBack="true" CssClass="pdfButton" runat="server"  Width="10%" Text="Print Validations" CommandName="ExportToPdf"/>
       
                        </CommandItemTemplate>
                        <Columns>
                            <telerik:GridBoundColumn DataField="clientRef" DataFormatString="{0:dd/MM/yy}" HeaderText="Client Ref"><ItemStyle Width="12%" VerticalAlign="Top" />
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="ServiceName" HeaderText="Service Name"><ItemStyle Width="28%" VerticalAlign="Top" />
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="commencementDate" DataFormatString="{0:dd/MM/yy}" HeaderText="Start Date"><ItemStyle Width="12%"  VerticalAlign="Top" />
                            </telerik:GridBoundColumn>
                            <telerik:GridTemplateColumn UniqueName="validations" HeaderText="Validations" SortExpression="CompanyName"  >
                                <ItemTemplate>
                                    <telerik:radgrid ID="rgdValidations"  OnNeedDataSource="rgdValidations_NeedDataSource" BorderStyle="None" ShowHeader="false" runat="server"  EnableViewState="true" >
                                        <MasterTableView>
                                            <ItemStyle Font-Size="Smaller" />
                                            <AlternatingItemStyle Font-Size="Smaller"/>
                                        </MasterTableView>
                                    </telerik:radgrid>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                        </Columns>
                    </MasterTableView>
                </telerik:RadGrid>

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
0
Daniel
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,
Daniel
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.
Tags
Grid
Asked by
Neil
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or