in my code behind I do this:
at runtime the exported file name becomes "This+is+a+report+export+file+generated+in+2010"
am I doing something wrong?
RadGrid1.ExportSettings.FileName = "This is a report export file generated in " + DateTime.Now.Year.ToString();
at runtime the exported file name becomes "This+is+a+report+export+file+generated+in+2010"
am I doing something wrong?
6 Answers, 1 is accepted
0
Hello SF,
I'm afraid this is browser-specific behavior. Please try another browser - IE7, Firefox, Opera, etc and let me know whether the problem still persists.
Best regards,
Daniel
the Telerik team
I'm afraid this is browser-specific behavior. Please try another browser - IE7, Firefox, Opera, etc and let me know whether the problem still persists.
Best regards,
Daniel
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

Lubna Ansari
Top achievements
Rank 1
answered on 28 Jul 2010, 09:24 AM
Hi Daniel,
Firefox is working fine but IE7 is having the same problem.
Firefox is working fine but IE7 is having the same problem.
0
Hello Lubna,
The file name is encoded as UTF-8 string and this causes Internet Explorer 8 to interpret the whitespace characters as pluses. If you sidestep this functionality (it is possible) you won't be able to use non-US characters in the file name.
Regards,
Daniel
the Telerik team
The file name is encoded as UTF-8 string and this causes Internet Explorer 8 to interpret the whitespace characters as pluses. If you sidestep this functionality (it is possible) you won't be able to use non-US characters in the file name.
Regards,
Daniel
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

treesara
Top achievements
Rank 1
answered on 04 Nov 2010, 06:27 PM
How would one sidestep this encoding?
0
Hello Treesara,
Please try the following approach:
Kind regards,
Daniel
the Telerik team
Please try the following approach:
protected
void
RadGrid1_GridExporting(
object
source, GridExportingArgs e)
{
if
(e.ExportType == ExportType.Excel)
{
string
filename = RadGrid1.ExportSettings.FileName;
string
fileExtension = RadGrid1.ExportSettings.Excel.FileExtension;
this
.Response.ClearHeaders();
this
.Response.AddHeader(
"Content-Disposition"
,
"attachment;filename=\""
+ filename +
"."
+ fileExtension +
"\""
);
}
}
Kind regards,
Daniel
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

Vasssek
Top achievements
Rank 1
answered on 21 Apr 2015, 12:15 PM
Hi,
here is another solution.
protected void RadGrid1_GridExporting(object source, GridExportingArgs e)
{
if (e.ExportType == ExportType.Excel || e.ExportType == ExportType.ExcelML || e.ExportType == ExportType.ExcelXlsx || e.ExportType == ExportType.ExcelBiff)
{
string filename = RadGrid1.ExportSettings.FileName;
string fileExtension = RadGrid1.ExportSettings.Excel.FileExtension;
var headerValue = (Request.UserAgent.ToLower().Contains("msie")) ? string.Format("attachment; filename=\"{0}\"", Uri.EscapeDataString(filename + "." + fileExtension)) : string.Format("attachment; filename=\"{0}\"", filename + "." + fileExtension); //for Firefox, Chrome, Safari, Opera
this.Response.ClearHeaders();
this.Response.AddHeader("Content-Disposition", headerValue);
}
}
This way, you can have also filenames with UTF8 characters (spaces, diacritics...)
Best regards
Vasssek