Ho scoperto che questo codice
codice:
Protected Sub ExportToExcel(sender As Object, e As EventArgs)
Dim nomefile = "XLS_export"
Response.Clear()
Response.Buffer = True
Response.AddHeader("content-disposition", "attachment;filename=" & nomefile & ".xls")
Response.Charset = ""
Response.ContentType = "application/vnd.ms-excel"
Using sw As New StringWriter()
Dim hw As New HtmlTextWriter(sw)
hw.WriteLine("<b>Giacenze:</b>")
'style to format numbers to string
Dim style As String = "<style> .textmode { } </style>"
Response.Write(style)
' Response.Output.Write(sw.ToString())
Dim stringa As String = sw.ToString()
Response.Output.Write(stringa)
Response.Flush()
Response.End()
End Using
End Sub
che uso per esportare verso excel alcuni dati, funziona solo in assenza di un updatepanel... ho provato infatti a rimuoverlo e il file viene generato correttamente mentre se invece lo lascio, trovo nella finestra di ispezione del browser l'errore seguente:
Error: Sys.WebForms.PageRequestManagerParserErrorExceptio n: Impossibile analizzare il messaggio ricevuto dal server.
Si può mica fare in modo che funzichi senza togliere l'updatepanel?