I have an export to csv button that worked untill I Ajaxified all controls on this page with an ajaxpanel.
I get a javascript error as follows:
[Exception... "'Sys.WebForms.PageRequestManagerParserErrorException: 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 '"Source","Source Cre'.'
My code resembles the one below:
Thanx for the help.
<asp:LinkButton ID="ExportLinkButton" runat="server" CssClass="export linkText menu left" Text="Export CSV"
OnClick="export_Clicked" ToolTip="Export to csv" ></asp:LinkButton>
protected void export_Clicked(object sender, EventArgs e)
{
string fname= "path/FileName.csv";
string path = MapPath(fname);
string name = Path.GetFileName(path);
string ext = Path.GetExtension(path);
string type = "text/csv";
Response.ContentType = type;
Response.AppendHeader("content-disposition", "attachment; filename=" + name);
Response.WriteFile(path);
Response.End();
}
I get a javascript error as follows:
[Exception... "'Sys.WebForms.PageRequestManagerParserErrorException: 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 '"Source","Source Cre'.'
My code resembles the one below:
Thanx for the help.
<asp:LinkButton ID="ExportLinkButton" runat="server" CssClass="export linkText menu left" Text="Export CSV"
OnClick="export_Clicked" ToolTip="Export to csv" ></asp:LinkButton>
protected void export_Clicked(object sender, EventArgs e)
{
string fname= "path/FileName.csv";
string path = MapPath(fname);
string name = Path.GetFileName(path);
string ext = Path.GetExtension(path);
string type = "text/csv";
Response.ContentType = type;
Response.AppendHeader("content-disposition", "attachment; filename=" + name);
Response.WriteFile(path);
Response.End();
}