I'm sorry to be a bother but that didn't work. It's not even coming up on the page as the export to excel is coming up right away. This is what I have.
Private Sub export(ByVal gridview As GridView) Response.Clear()
Response.Buffer = True
Response.AddHeader("content-disposition", "attachment;filename=GridViewExport.xls")
Response.Charset = ""
Response.ContentType = "application/vnd.ms-excel"
Dim sw As New IO.StringWriter() Dim hw As New HtmlTextWriter(sw)
GridView1.AllowPaging = False GridView1.DataBind()
GridView1.Caption = "T2 DI Region Pending Claims Listings"
GridView1.HeaderRow.Attributes.Add("style", "font-size:10px")
For i As Integer = 0 To GridView1.Rows.Count - 1
Dim row As GridViewRow = GridView1.Rows(i)
'Change Color back to white
row.BackColor = System.Drawing.Color.White
'Apply text style to each Row
row.Attributes.Add("class", "textmode") Next
'Remove Controls Me.RemoveControls(GridView1)
GridView1.RenderControl(hw) 'style to format numbers to string
Dim style As String = "<style> .textmode { mso-number-format:\@; } </style>"
Response.Write(style) Response.Output.Write(sw.ToString())
Response.Flush() Response.[End]() End Sub