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

Export parent row

4 Answers 34 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Deborah
Top achievements
Rank 1
Deborah asked on 01 Aug 2013, 10:03 AM
Hi,
I have a two-level gridview.
This is the definition of the child gridview:
<telerik:RadGridView.HierarchyChildTemplate>
                    <DataTemplate>
                        <Grid x:Name="LayoutRoot2">
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                                <RowDefinition Height="33" />
                            </Grid.RowDefinitions>
                            <telerik:RadGridView Name="gridContatti"
                                                 AutoGenerateColumns="False"
                                                 IsReadOnly="True"
                                                 Loaded="gridContatti_Loaded"
                                                 Margin="8,8,8,4"
                                                 telerik:StyleManager.Theme="Summer"
                                                 Grid.Row="0"
                                                 EnableColumnVirtualization="False"
                                                 EnableRowVirtualization="False"
                                                 ClipboardCopyMode="Cells"
                                                 ClipboardPasteMode="Cells"
                                                 SelectionMode="Extended"
                                                 SelectionUnit="Mixed"
                                                 ElementExporting="gridContatti_ElementExporting">
                                <telerik:RadGridView.Columns>
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding IdContatto}"
                                            Header="Id Cont"
                                            Width="75"/>
                                     <telerik:GridViewDataColumn DataMemberBinding="{Binding Telefono}"
                                            Header="Telefono"
                                            Width="115"/>
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Fax}"
                                            Header="Fax"
                                            Width="115"/>
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Mail}"
                                            Header="Email"
                                            Width="250"/>
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Note}"
                                            Header="Note"
                                            Width="250"/>
                                </telerik:RadGridView.Columns>
                            </telerik:RadGridView>
                            <StackPanel HorizontalAlignment="Right"
                                    Name="stackPanExportDet"
                                    VerticalAlignment="Center"
                                    Orientation="Horizontal"
                                    Grid.Row="1"
                                    Margin="8,0,8,8">
                                <Button x:Name="btnExportDet" Content=" Esporta in Excel " Height="25" Click="btnExportDet_Click"/>
                            </StackPanel>
                        </Grid>
                    </DataTemplate>
                </telerik:RadGridView.HierarchyChildTemplate>

When I export this child gridview in excel I'd like to add, on the top of the file, the parent row and the headers of the parent row.
Is it possible?
Thank you very much.

4 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 05 Aug 2013, 11:12 AM
Hello,

I am not sure how you have implemented the exporting functionality, but generally, when exporting hierarchy, I would suggest you to work with the data items as demonstrated on the "Exporting RowDetails" WPF Demo. You can check the code inside "ElementExported' event handler.

Does this approach work for you?

Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Deborah
Top achievements
Rank 1
answered on 23 Aug 2013, 01:24 PM

Hi Didie,
I don't want to export the parent gridview with the detail of all its rows...
I want to export a single child gridview with its parent row.
I have attached a picture.
Thank you,

Deborah

0
Accepted
Dimitrina
Telerik team
answered on 26 Aug 2013, 07:39 AM
Hi Deborah,

You can then check our online demo on exporting and try the same for the child GridView. You can use the childGridView.ParentRow.Item to get information for the parent row.

Please keep in mind that adding a row on top is not an option available out of the box. You can check this forum thread where a sample project showing how to export an additional row at the top is attached. It is for WPF, but the approach for Silverlight would be similar.

Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Deborah
Top achievements
Rank 1
answered on 18 Sep 2013, 12:30 PM
Hi Didie, it works.
Thank you very much,
Deborah
Tags
GridView
Asked by
Deborah
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Deborah
Top achievements
Rank 1
Share this question
or