Hi folks, I have written a Restful service and consuming the service using jquery.
I have written a piece of code to export to excel in the restful code but when we call this service,
application is not poping up the excel dialog window.
but if i add this piece of code in the aspx page its work fine. How can i make this code to work inside the service. Below is the code im using
GridView gv = new GridView();
gv.DataSource =fetch();
gv.DataBind();
Response.ClearContent();
Response.Buffer = true;
Response.AddHeader("content-disposition", "attachment; filename=test.xls");
Response.ContentType = "application/ms-excel";
Response.Charset = "";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
gv.RenderControl(htw);
Response.Output.Write(sw.ToString());
Response.Flush();
Response.End();