<code>
Response.ClearContent();<br />
            Response.AddHeader("content-disposition", "attachment;filename=ArchivoExcel.xls");<br />
            Response.Charset = "";<br />
            Response.Cache.SetCacheability(HttpCacheability.NoCache);<br />
            Response.ContentType = "application/vnd.xls";<br />
<br />
            System.IO.StringWriter stringWrite = new System.IO.StringWriter();<br />
            System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);<br />
<br />
            GridServidores.RenderControl(htmlWrite);<br />
            Response.Write(stringWrite.ToString());<br />
            Response.End();
</code>
Para que esto funcione en la cabecera del Archivo .aspx
<code>
EnableEventValidation = "false"
</code>
No hay comentarios:
Publicar un comentario