Exporting gridpanel content to excel
Hello,
I've been struggling for hours trying to find a solution to this problem that i've come across :S, i have to export the content of a gridpanel to a excel file,
this is supposed to be the function that does it :
Code:
void exportarExcel()
{
string attachment = "attachment; filename=Export.xls";
Response.ClearContent();
Response.AddHeader("content-disposition", attachment);
Response.ContentType = "application/ms-excel";
System.IO.StringWriter sw = new System.IO.StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
gridRegistroInserciones.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
}
Then i got to my web form and run the app, when i click the button that exports to excel all i get is this error
http://imageshack.us/photo/my-images/844/capturavb.png/
in case the image cannot be seen the error is this:
Code:
Status Code: 200
Status Text: BAD RESPONSE: Unexpected Token <
Please help! :(