Dim sb As StringBuilder = New StringBuilder()
Dim sw As IO.StringWriter = New IO.StringWriter(sb)
Dim htw As HtmlTextWriter = New HtmlTextWriter(sw)
Dim pagina As Page = New Page
Dim form = New HtmlForm
Me.gdv_movimientoCasete.EnableViewState = False
pagina.EnableEventValidation = False
pagina.DesignerInitialize()
pagina.Controls.Add(form)
form.Controls.Add(Me.gdv_movimientoCasete)
pagina.RenderControl(htw)
Response.Clear()
Response.Buffer = True
Response.Write("<h1>Movimiento de Casete</h1>")
Response.Write(Date.Today)
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("Content-Disposition", "attachment;filename=MovimientodeCasete.xls")
Response.Charset = "UTF-8"
Response.ContentEncoding = Encoding.Default
Response.Write(sb.ToString())
Response.End()