This question is locked. New answers and comments are not allowed.
Hi,
I have grid view with multiple hierarchies.
I need to export the data of parent grid view and child grid view data.
When i tried, able to export only parent grid data only.
The following is the design on of hierarchical grid view.
The following is the Export to Excel button functionality
Please give me a solution for exporting all the data.
I have grid view with multiple hierarchies.
I need to export the data of parent grid view and child grid view data.
When i tried, able to export only parent grid data only.
The following is the design on of hierarchical grid view.
<
telerik:RadGridView
Grid.Row
=
"1"
x:Name
=
"radJobDetails"
telerik:StyleManager.Theme
=
"Summer"
ShowGroupPanel
=
"False"
Height
=
"400"
ItemsSource
=
"{Binding service}"
EnableColumnVirtualization
=
"False"
RowStyle
=
"{StaticResource radGridRow}"
AlternateRowStyle
=
"{StaticResource radGridAltRow}"
AlternationCount
=
"2"
AutoGenerateColumns
=
"False"
RowIsExpandedChanged
=
"radJobDetails_RowIsExpandedChanged"
ElementExported
=
"radJobDetails_ElementExported"
>
<
telerik:RadGridView.ChildTableDefinitions
>
<
telerik:GridViewTableDefinition
>
<
telerik:GridViewTableDefinition.Relation
>
<
telerik:PropertyRelation
ParentPropertyName
=
"uaudioid"
></
telerik:PropertyRelation
>
</
telerik:GridViewTableDefinition.Relation
>
</
telerik:GridViewTableDefinition
>
</
telerik:RadGridView.ChildTableDefinitions
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding uaid}"
Header
=
"AID"
Width
=
"100"
IsReadOnly
=
"True"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding uaname}"
Header
=
"AName"
Width
=
"300"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding ufname}"
Header
=
"FName"
Width
=
"300"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding ums}"
Header
=
"Mins"
Width
=
"100"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding ulcnt}"
Header
=
"LCount"
Width
=
"100"
/>
</
telerik:RadGridView.Columns
>
<
telerik:RadGridView.HierarchyChildTemplate
>
<
DataTemplate
x:Name
=
"useraudioprivilages"
>
<
telerik:RadGridView
x:Name
=
"radUserPrivilageActions"
AutoGenerateColumns
=
"False"
ShowGroupPanel
=
"False"
ItemsSource
=
"{Binding service}"
RowStyle
=
"{StaticResource radGridRow}"
AlternateRowStyle
=
"{StaticResource radGridAltRow}"
AlternationCount
=
"2"
Loaded
=
"radUserPrivilageActions_Loaded"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding afilename}"
Header
=
"AFName"
Width
=
"300"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding auname}"
Header
=
"UName"
Width
=
"150"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding aadtime}"
Header
=
"Assigned Time"
Width
=
"150"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding awpname}"
Header
=
"Privilage"
Width
=
"200"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
</
DataTemplate
>
</
telerik:RadGridView.HierarchyChildTemplate
>
</
telerik:RadGridView
>
The following is the Export to Excel button functionality
private void btnExportToExcel_Click(object sender, RoutedEventArgs e)
{
ExportFormat format = ExportFormat.ExcelML;
bool? dialogResult = this.dialog.ShowDialog();
if (dialogResult == true)
{
radpageruserwiseaudios.PageSize = 0;
using (Stream stream = dialog.OpenFile())
{
GridViewExportOptions exportOptions = new GridViewExportOptions();
exportOptions.Format = format;
exportOptions.ShowColumnFooters = true;
exportOptions.ShowColumnHeaders = true;
exportOptions.ShowGroupFooters = true;
radJobDetails.Export(stream, exportOptions);
}
radpageruserwiseaudios.PageSize = 10;
}
}
Please give me a solution for exporting all the data.