This question is locked. New answers and comments are not allowed.
Hi,
I am trying to export the content of a RadGridView to Excel and everything works fine except for Column Groups.
With the column groups what ends up being exported is their Name property and not the actual value displayed on screen.
Here is a sample XAML I put together to simulate my scenario:
In this particular example I have got one column group and what I find exported in Excel is the Name of this column group, i.e. "ColumnGroup1", but I would like to have instead the Text of the TextBlock in the HeaderTemplate, which is the actual value displayed on screen for this column group, i.e. "Person Details".
Is there any way I can achieve this? Perhaps using the ElementExporting/ElementExported events?
I am using Silverlight 4 and your suite of Silverlight controls v2012.1.326.1040.
Thanks,
Raoul
I am trying to export the content of a RadGridView to Excel and everything works fine except for Column Groups.
With the column groups what ends up being exported is their Name property and not the actual value displayed on screen.
Here is a sample XAML I put together to simulate my scenario:
<
TextBlock
x:Name
=
"HeaderText"
Visibility
=
"Collapsed"
Text
=
"Person Details"
/>
<
telerik:RadGridView
x:Name
=
"PersonsGrid"
AutoGenerateColumns
=
"False"
ItemsSource
=
"{Binding List}"
>
<
telerik:RadGridView.ColumnGroups
>
<
telerik:GridViewColumnGroup
Name
=
"ColumnGroup1"
>
<
telerik:GridViewColumnGroup.HeaderTemplate
>
<
DataTemplate
>
<
TextBlock
Text
=
"{Binding Text, ElementName=HeaderText}"
TextAlignment
=
"Center"
FontWeight
=
"Bold"
/>
</
DataTemplate
>
</
telerik:GridViewColumnGroup.HeaderTemplate
>
</
telerik:GridViewColumnGroup
>
</
telerik:RadGridView.ColumnGroups
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
Header
=
"ID"
DataMemberBinding
=
"{Binding ID}"
TextAlignment
=
"Center"
/>
<
telerik:GridViewDataColumn
Header
=
"Name"
DataMemberBinding
=
"{Binding Name}"
ColumnGroupName
=
"ColumnGroup1"
/>
<
telerik:GridViewDataColumn
Header
=
"Age"
DataMemberBinding
=
"{Binding Age}"
TextAlignment
=
"Center"
ColumnGroupName
=
"ColumnGroup1"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
In this particular example I have got one column group and what I find exported in Excel is the Name of this column group, i.e. "ColumnGroup1", but I would like to have instead the Text of the TextBlock in the HeaderTemplate, which is the actual value displayed on screen for this column group, i.e. "Person Details".
Is there any way I can achieve this? Perhaps using the ElementExporting/ElementExported events?
I am using Silverlight 4 and your suite of Silverlight controls v2012.1.326.1040.
Thanks,
Raoul