Export parent row

5 posts, 1 answers
  1. Deborah
    Deborah avatar
    31 posts
    Member since:
    Jun 2011

    Posted 01 Aug 2013 Link to this post

    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.
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 05 Aug 2013 Link to this post

    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 >>
  3. DevCraft banner
  4. Deborah
    Deborah avatar
    31 posts
    Member since:
    Jun 2011

    Posted 23 Aug 2013 Link to this post

    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

  5. Answer
    Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 26 Aug 2013 Link to this post

    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 >>
  6. Deborah
    Deborah avatar
    31 posts
    Member since:
    Jun 2011

    Posted 18 Sep 2013 Link to this post

    Hi Didie, it works.
    Thank you very much,
    Deborah
Back to Top
DevCraft banner