Posted on: 1/7/2014 5:04:55 AM | Views : 819

string fileName = "attachment;filename= DetailReport.xlsx"; Response.Clear(); Response.AddHeader("content-disposition", fileName); Response.Charset = ""; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = "application/vnd.ms-excel"; System.IO.StringWriter stringWrite = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); GridUser.RenderControl(htmlWrite); Response.Output.Write(stringWrite.ToString()); Response.Flush(); Response.End();
An exception of type 'System.Web.HttpException' occurred in System.Web.dll but was not handled in user code
Additional information: ???м??? ?????????? 'MainContent_GridUser' ???? 'GridView' ?????? ???? ??м???? ?????? ???? ???м? ? ????м????м runat=server.

Go to the complete details ...