问题描述:

Update: I notice i receive

Uncaught Sys.WebForms.PageRequestManagerParserErrorException: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed.

This are the main parts of the code:

My main file header:

<%@ Register Src="~/UserControls/HostsControl.ascx" TagPrefix="hosts" TagName="HostsControl" %>

The hostControl Uses:

<%@ Register Src="~/UserControls/DataGridView.ascx" TagPrefix="dtbl" TagName="DataGridView" %>

In the datagridView i have an event:

<asp:ImageButton ID="imgExportToExcel" ImageUrl="~/images/files/excel.png" ToolTip="Export to excel" AlternateText="Excel" OnClick="ExportToExcel" runat="server" />

Now on the ExportToExel I have:

...create exel logic

FileInfo file = new FileInfo(filePath);

if (file.Exists)

{

Response.ClearContent();

Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);

Response.AddHeader("Content-Length", file.Length.ToString());

Response.ContentType = "text/plain";

Response.TransmitFile(file.FullName);

Response.End();

}

The problem is the file isn't download. I think it because I use the Response from a Control

Please tell me if any information is missing

相关阅读:
Top