Jun 29, 2017 03:03 PM|funluckykitty|LINK
Hi there. I have a gridview that pulls data from a sqldatasource in vb.net. Part of the codebehind includes an event on the gridview rowDataBound event that loops thru and creates subtotals on the gridview. This all works great. The problem I'm having
is when I export to excel. For some reason, the subtotals are not included in the Excel File that is created. Here's my code that creates the Excel. What am I forgetting to do? Why aren't the subtotals included in the Excel worksheet?
Private Sub ExportToExcel(ByVal strFileName As String, ByVal dg As GridView)
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("content-disposition", "attachment;filename=" & strFileName)
Response.Charset = ""
Me.EnableViewState = False
Dim StringWriter As New System.IO.StringWriter()
Dim HtmlTextWriter As New System.Web.UI.HtmlTextWriter(StringWriter)