Tengo un problema al exportar desde un gridview hacia excel, me sale el siguiente mensaje: El argumento 'Prompt' no se puede convertir en el tipo 'String'.
Les dejo mi código para que me digan que está mal:
Private Sub ExportToExcel(ByVal dtTemp As DataTable, _
ByVal filepath As String)
gvExcel.DataSource = dtTemp
gvExcel.DataBind()
Dim nameReport As String = "ListaExcepciones"
Dim responsePage As HttpResponse = Response
Dim sw As New StringWriter()
Dim htw As New HtmlTextWriter(sw)
Dim pageToRender As New Page()
Dim form As New HtmlForm()
form.Controls.Add(gvExcel)
pageToRender.Controls.Add(form)
responsePage.Clear()
responsePage.Buffer = True
responsePage.ContentType = "application/excel"
responsePage.AddHeader("Content-Disposition", "attachment;filename=" & nameReport & ".xls")
responsePage.Charset = "UTF-8"
responsePage.ContentEncoding = Encoding.Default
pageToRender.RenderControl(htw)
responsePage.Write(sw.ToString())
responsePage.End()
end sub