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

XML export bug in RadGridView

8 Answers 69 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Charles Covell
Top achievements
Rank 1
Charles Covell asked on 09 Feb 2011, 08:20 PM
Hi,

When using the "export to XML" feature of RadGridView, the resulting XML file is not proper XML when the GridView's data contains strings with the "<>" characters with something between them.  This appears to be because XML special characters:
< > & %
--are not escaped properly.

Would it be possible to get a fix/workaround for this?

Thanks!

Charley

8 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 10 Feb 2011, 08:34 AM
Hello Charles Covell,

You can try escaping those characters in the ElementExporting event of RadGridView.

Kind regards,
Veselin Vasilev
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Charles Covell
Top achievements
Rank 1
answered on 10 Feb 2011, 05:57 PM
Thanks for your response.  I was able to solve the issue by using your workaround.

In case anyone else reads this topic, here is the code for the ElementExporting callback I used:

private void myRadGridView_ElementExporting(object sender, GridViewElementExportingEventArgs e)
{
    if (e.Value != null && e.Value.GetType() == typeof(string))
    {
        e.Value = (e.Value as string).Replace("&", "&");
        e.Value = (e.Value as string).Replace("<", "<");
        e.Value = (e.Value as string).Replace(">", ">");
        e.Value = (e.Value as string).Replace("\"", """);
        e.Value = (e.Value as string).Replace("\'", "&apos;");
    }
}

Thanks,

Charley
0
ErrolM
Top achievements
Rank 1
answered on 15 Jul 2011, 04:39 AM
Good afternoon Veselin,

Do Telerik have plans to implement this instead of all developers having to do it themselves?
I notice there is a ShouldEncodeValue field on the args (though I tried that before searching for this post).

Cheers,
Errol
0
Pavel Pavlov
Telerik team
answered on 20 Jul 2011, 02:29 PM
Hi Errol Melvin,

I am shcheduling this for improvement for our next official release.

Regards,
Pavel Pavlov
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
azbola
Top achievements
Rank 1
answered on 09 Jan 2012, 01:57 PM
Did this ever make it into a release?

I seem to now see that headers are correctly encoded, but not data cells?

Thanks.
0
Pavel Pavlov
Telerik team
answered on 12 Jan 2012, 04:22 PM
Hello Charles,

Please try the following :
public MainPage()
{
    InitializeComponent();
     
    gridView.Exporting += new EventHandler<GridViewExportEventArgs>(gridView_Exporting);
     
}
 
void gridView_Exporting(object sender, GridViewExportEventArgs e)
{
    e.ShouldEncodeValue = true;
}


Kind regards,
Pavel Pavlov
the Telerik team

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

0
Pavel Pavlov
Telerik team
answered on 12 Jan 2012, 04:28 PM
Hello Charls ,

A quick update - for the latest versions please use the ElementExporting event instead .

* The Exporting event was recently  obsoleted.

Kind regards,
Pavel Pavlov
the Telerik team

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

0
Mohd
Top achievements
Rank 1
answered on 16 Jan 2012, 06:40 AM
I am waiting for a reply from a long time


http://www.telerik.com/community/forums/silverlight/gridview/radgrid-export-to-excel-unable-to-maintain-decimal-format-for-number-less-than-4-digits.aspx
Tags
GridView
Asked by
Charles Covell
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Charles Covell
Top achievements
Rank 1
ErrolM
Top achievements
Rank 1
Pavel Pavlov
Telerik team
azbola
Top achievements
Rank 1
Mohd
Top achievements
Rank 1
Share this question
or