RadToolBarButton and returning a file

2 posts, 1 answers
  1. Paul Evers
    Paul Evers avatar
    52 posts
    Member since:
    Oct 2011

    Posted 13 Mar 2012 Link to this post

    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
  2. Answer
    Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 13 Mar 2012 Link to this post

    Hello Paul,

    Is you RadToolBar using ajax? If so, that would be the reason you cannot transmit a file.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top