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

[Solved] Problem with Exporting to Html

1 Answer 148 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Przemyslaw
Top achievements
Rank 1
Przemyslaw asked on 19 Nov 2009, 10:01 AM
Hello,

First of all I would like to congratulate Telerik on launching the JustCode tool. I have started using it today at work and it seems to be extremely  valuable.

I am experiencing problems with exporting of GridView to Html format.

I am setting my grid's ItemsSource to an ObservableCollection:
ObservableCollection<PartnerStatsEntry> AllStatsForPartner = new ObservableCollection<PartnerStatsEntry>(); 
gridPerformance.ItemsSource = AllStatsForPartner; 

Some of the columns have xaml binding like this:
<Controls:GridViewDataColumn DataMemberBinding="{Binding Converter = {StaticResource PartnerAgeConverter}}" UniqueName="partnerAge" /> 

and when I export this GridView to Html the data is displayed properly.

Other columns use binding on the whole data row object like this:
<Controls:GridViewDataColumn DataMemberBinding="{Binding Converter={StaticResource WholeObjectConverter}}" /> 

In this case, since I do not provide the UniqueName property, the binding is done on the whole row object of type PartnerStatsEntry, instead of just one of its properties as it was the case in the previous snippet. The WholeObjectConverter returns a string value that is a function of more than one property the PartnerStatsEntry class. The proper value is displayed in the grid.

However, when I export the GridView to Html, all I get for these cells is just the name of the binding object (PartnerStatsEntry) and not the converted value as I would wish.

Is there a way to solve this problem or go around it somehow?

Best regards, Przemek

1 Answer, 1 is accepted

Sort by
0
Accepted
Tsvyatko
Telerik team
answered on 24 Nov 2009, 04:52 PM
Hello Przemyslaw,

Unfortunately Value Convertors are not used when export format is generated.
However you can control the content output using Exporting event. It gives direct access to the output value. DataFormatString is also applied.

I am attaching sample application that demonstrates how custom values can be build. If you have any more questions do not hesitate to contact me.

Regards,
Tsvyatko
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Przemyslaw
Top achievements
Rank 1
Answers by
Tsvyatko
Telerik team
Share this question
or