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

Exporting Selected Columns

3 Answers 59 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ahmet Özgür
Top achievements
Rank 1
Ahmet Özgür asked on 14 Apr 2010, 07:39 AM
Hi,

Is there a way to export only the specified columns to excel. If not ;
<telerik:GridViewDataColumn IsFilterable="False" IsGroupable="False" IsReadOnly="True" IsSortable="False" Header="Adet" Width="125"
                        <telerik:GridViewDataColumn.CellTemplate> 
                            <DataTemplate> 
                                <StackPanel Orientation="Horizontal"
                                    <TextBlock Text="{Binding ItemAmount}" FontWeight="Bold"/> 
                                    <TextBlock Text=" yerine "/> 
                                    <TextBlock Text="{Binding ArrivedAmount}" FontWeight="Bold"/> 
                                </StackPanel> 
                            </DataTemplate> 
                        </telerik:GridViewDataColumn.CellTemplate> 
                         
                    </telerik:GridViewDataColumn> 

As you see at the code above i am using e cell template at the grid column. While exporting it does not export the data inside the cell template. Is the a way to solve this.

Regards.

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 14 Apr 2010, 07:48 AM
Hello,

The grid will export only visible column - if you do not want any particular column you can set IsVisible to false. You can use the Exporting event to set desired e.Value for such columns - please refer to our examples.

Best wishes,
Vlad
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Ahmet Özgür
Top achievements
Rank 1
answered on 14 Apr 2010, 08:14 AM
I don't want to make its visibility false. Because it is needed at user interface. but while exporting it is not needed. Also e.value returns null every time.
0
Vlad
Telerik team
answered on 14 Apr 2010, 09:38 AM
Hello,

The idea is to set desired value for IsVisible before exporting and restore the original value after exporting. e.Value is null since you have template and in this case you should decide what to set in e.Value.

Sincerely yours,
Vlad
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
Ahmet Özgür
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Ahmet Özgür
Top achievements
Rank 1
Share this question
or