Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear All,

I have a label named "lblExportStatus" that is hidden with no text. I want to display the label during Gridview export to excel.

The label is being displayed after below 3 statements

C#
Response.Clear();
                Response.Buffer = true;
                Response.Charset = "";
                lblExportStatus.Visible = true;
                lblExportStatus.Text = "Export Successful";


But when I write Response.ContentType, Response.AddHeader as below,

C#
Response.Clear();
               Response.Buffer = true;
               Response.Charset = "";
               Response.ContentType = "application/vnd.ms-excel";
               Response.AddHeader("content-disposition", "attachment;filename=Test.xls");
               lblExportStatus.Visible = true;
               lblExportStatus.Text = "Export Successful";


Label is not getting displayed on the page. Any help or suggestion would be appreciable.

Regards,
Posted
Updated 20-Nov-14 20:28pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900