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

how to export gridview and row details together

4 Answers 36 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Joe
Top achievements
Rank 1
Joe asked on 01 Dec 2011, 01:56 AM
Is there a way to export Gridview with its rowdetails together using Export() function?
I have a gridview, which has another gridview as its rowdetails, I want to export the selected gridview and its rowdetails together to make a full row, how should I do this?

4 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 01 Dec 2011, 08:49 AM
Hello Joe,

You could export the rowdetails GridView in the ElementExported event of the RadGridView.
Please check this online demo for a further reference.

Kind regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Joe
Top achievements
Rank 1
answered on 01 Dec 2011, 06:46 PM
Thanks Didie,

I tried that but it does not go to the class. And I do not understand how that code get the rowdetails, what is this code CommandParameter="{Binding Content.Children[0]}" for ?

I actually want both of the GridView data and the rowdetails data, the demo is only for rowdetails even though I cannot make this work either.

Can you help me to understand this code?

this is my gridview, I deleted the Command="{Binding ExportCommand, Source={StaticResource context}}"
                               CommandParameter="{Binding Content.Children[0]}" from that radbutton.
   
        <Grid Name="ContentGrid" Margin="0,35,0,0">
            <Grid.RowDefinitions>
                <RowDefinition Height="20" />
                <RowDefinition Height="*" />
              
            </Grid.RowDefinitions>
            <Grid Name="button" Grid.Row="0">
                <Grid.ColumnDefinitions>
                   
                    <ColumnDefinition Width="100"/>
                    <ColumnDefinition Width="*" />
                    
                </Grid.ColumnDefinitions>           
            <telerik:RadButton x:Name="radChart" Width="94" Height="20" HorizontalAlignment="Center" VerticalAlignment="Center" Content="Generate chart" Click="radbutton_click"  Grid.Column="0">
                    
                </telerik:RadButton>
                <telerik:RadButton x:Name="radChartExport" Width="88" Height="20" Content="Export Metrics"  VerticalAlignment="Center"  Grid.Column="1" HorizontalAlignment="Center" Margin="0,0,452,0"></telerik:RadButton>
            </Grid>
            <telerik:RadGridView x:Name="ExpgridView"  Grid.Row="1" SelectionMode="Extended" ScrollMode="Deferred" AlternateRowBackground="Gray" ColumnWidth="*" RowIndicatorVisibility="Visible"
                              SelectionUnit="FullRow" CanUserSelect="True"  LoadingRowDetails="ExpgridView_LoadingRowDetails"  ElementExporting="ExpgridView_ElementExporting"
                             ElementExported="ExpgridView_ElementExported" AutoGenerateColumns="False" CanUserReorderColumns="True" IsReadOnly="True" SelectionChanged="ExpgridView_SelectionChanged" CanUserInsertRows="False" Grid.RowSpan="2">


                <telerik:RadGridView.Columns>
                    <telerik:GridViewToggleRowDetailsColumn />
                  

                    <telerik:GridViewDataColumn DataMemberBinding="{Binding ExperimentDateTime}" DataFormatString="{}{0:MM/dd/yyyy}" Header="Exeperiment Date"/>
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding ExperimentUser}" Header="Experiment User" />
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding ValidationDateStartTime}" Header="Validation StartTime" />
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding ValidationDateEndTime}" Header="Validation EndTime" />
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding TrainingDateStartTime}" Header="Training StartTime" />
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding TrainingDateEndTime}" Header="Training EndTime" />
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding AetherDescription}" Header="Description" TextWrapping="NoWrap"  TextTrimming="WordEllipsis" IsResizable="True"/>
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding AetherGUID}" IsGroupable="false" Header="AetherGUID" />
                </telerik:RadGridView.Columns>



                <telerik:RadGridView.RowDetailsTemplate>
                    <DataTemplate>
                        <telerik:RadGridView x:Name="ExpMetricsgridView"   AllowDrop="False" ShowGroupPanel="False" GridLinesVisibility="Both"  IsFilteringAllowed="False" AutoGenerateColumns="False" IsReadOnly="True">

                            <telerik:RadGridView.Columns>
                                <telerik:GridViewDataColumn DataMemberBinding="{Binding Position}" Header="Position" />
                                <telerik:GridViewDataColumn DataMemberBinding="{Binding RigProd}" Header="Production RIG" />
                                <telerik:GridViewDataColumn DataMemberBinding="{Binding RigExpt}" Header="Experiment RIG" />
                                <telerik:GridViewDataColumn DataMemberBinding="{Binding RIGAdPredict}" Header="AdPredictor RIG" />
                                <telerik:GridViewDataColumn DataMemberBinding="{Binding AvgPClickProd}" Header="Production AvgPClick" />
                                <telerik:GridViewDataColumn DataMemberBinding="{Binding AvgPClickExpt}" Header="Experiment AvgPClick" />
                                <telerik:GridViewDataColumn DataMemberBinding="{Binding Impression}" Header="Impression" />
                                <telerik:GridViewDataColumn DataMemberBinding="{Binding Clicks}" Header="Clicks" />
                            </telerik:RadGridView.Columns>
                        </telerik:RadGridView>
                    </DataTemplate>
                </telerik:RadGridView.RowDetailsTemplate>

            </telerik:RadGridView>
            
            
        </Grid>

0
Joe
Top achievements
Rank 1
answered on 01 Dec 2011, 09:13 PM
Can you tell me what that Content.Children[0] is for ? or what para I have to pass in? that field is always null in my app.
0
Dimitrina
Telerik team
answered on 06 Dec 2011, 09:48 AM
Hello Joe,

The Content.Children[0] is the RadGridView and it is passed as an object to be exported. You do not need to use a command and pass a command parameter if you do not want.

Please take a look at this forum post, where you could download a sample project about exporting RowDetails/Hierarchy.

Let me know if you have any further questions on that project.

Regards,
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Tags
GridView
Asked by
Joe
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Joe
Top achievements
Rank 1
Share this question
or