Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/01/2005, 07:21
jhernanp
 
Fecha de Ingreso: octubre-2004
Mensajes: 71
Antigüedad: 20 años, 3 meses
Puntos: 0
Error el exportar a excel un datagrid paginado

Tengo el siguiente codigo para exportar un datagrid a excel:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim g As New Guid()
Dim oResponse As System.Web.HttpResponse _
= System.Web.HttpContext.Current.Response
oResponse.Clear()
oResponse.AddHeader("Content-Disposition", _
"attachment; filename=Informe.xls")
oResponse.ContentType = "application/vnd.ms-excel"
Dim stringWrite As New System.IO.StringWriter()
Dim htmlWrite As New System.Web.UI.HtmlTextWriter(stringWrite)
DGprueba.RenderControl(htmlWrite)
oResponse.Write(stringWrite.ToString)
oResponse.End()
End Sub

Funcionaba muy bien hasta que pagine el datagrid, espero que alguien me pueda ayudar para saber cual es el error o que es lo que esta pasando.

Muchas Gracias como siempre...