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

RadToolBarButton and returning a file

1 Answer 50 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Paul Evers
Top achievements
Rank 2
Paul Evers asked on 13 Mar 2012, 10:41 AM
Hi,

I want to sent a text-file to the client in response of clicking a toolbarbutton.
The code to send the file:
Response.ContentType = "text/txt";
Response.AppendHeader("Content-Disposition", "attachment; filename=project_input_export.txt");
Response.TransmitFile(Server.MapPath("~/Export/project_input_export.txt"));
Response.End();

When I click on the the toolbarbutton I get the following error:
=============
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near '##EXPORT##: 13-mrt-1'.
=============

When I call the same code from a RadButton the file is transmitted correctly.
Why can't I get the file from a toolbarbutton?

Paul

1 Answer, 1 is accepted

Sort by
0
Accepted
Kevin
Top achievements
Rank 2
answered on 13 Mar 2012, 01:49 PM
Hello Paul,

Is you RadToolBar using ajax? If so, that would be the reason you cannot transmit a file.
Tags
ToolBar
Asked by
Paul Evers
Top achievements
Rank 2
Answers by
Kevin
Top achievements
Rank 2
Share this question
or