I have a gridview that the user can select rows from to export that data to excel. After they select the rows they want to export they press a button. After I export the data to the spread sheet I want my page to refresh. I rebind my gridview to nothing to clear it out, but my page is not getting refreshed.
Any ideas?
Here is my code to put the datatable that I extracted from the gridview to excel ...
Any ideas?
Here is my code to put the datatable that I extracted from the gridview to excel ...
Dim wb As New ClosedXML.Excel.XLWorkbook()
wb.Worksheets.Add(dt, dt.TableName.ToString)
Response.Clear()
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
Response.AddHeader("content-disposition", "attachment;filename=MasterCredReport.xlsx")
Using memoryStream As New MemoryStream()
wb.SaveAs(memoryStream)
memoryStream.WriteTo(Response.OutputStream)
memoryStream.Close()
End Using