System.Web.HttpContext httpContext = HttpContext.Current;
httpContext.Response.Clear();
httpContext.Response.AddHeader("content-disposition",
string.Format("attachment;filename={0}.xls", ExcelFileName));
httpContext.Response.Charset = "";
httpContext.Response.ContentType = "application/vnd.xls";
StringWriter stringWrite = new StringWriter();
HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
repControl.RenderControl(htmlWrite); //Here repeatercontorl is id of repeater
httpContext.Response.Write(stringWrite.ToString());
httpContext.Response.End();
No comments:
Post a Comment