The Below Code i have used to Export for CSV Format
< Dim FileFullPath As String = System.IO.Path.GetFullPath(psPhysicalFileName)
Dim FileExtension As String = System.IO.Path.GetExtension(FileFullPath)
Dim OriginalFileName As String = System.IO.Path.GetFileName(psOriginalFileName)
Dim FileType As String = String.Empty
Dim FileContentType As String = String.Empty
Try
If Not IsDBNull(FileExtension) Then
FileType = LCase(FileExtension)
Select Case FileType
Case ".html"
FileContentType = "text/HTML"
Case ".gif"
FileContentType = "image/GIF"
Case "jpeg"
FileContentType = "image/JPEG"
Case ".txt"
FileContentType = "text/plain"
Case ".csv"
FileContentType = "text/csv"
End Select
End If
If (forceDownload) Then
Response.AppendHeader("content-disposition", _
"attachment; filename=" & OriginalFileName)
End If
If FileType <> String.Empty Then
Response.ContentType = FileContentType
End If
Response.WriteFile(FileFullPath.ToString())
If Not LabelMessage Is Nothing Then
lblMessage.Text = "You have downloaded the file " & OriginalFileName
End If
Response.End()
Catch oEx As Exception
If Not LabelMessage Is Nothing Then
lblMessage.Text = "Error downloading the file " & OriginalFileName
End If
Finally
End Try
>
In one cell,i get output like
"Left Message – VM" Instead of "Left Message - VM"
Thanks in Advance