hello coders, first i am inserting some values to grid view then exporting it to excel but post export i found "
" (Edit - this is a non-breaking space) in excel where i have inserted null value in grid.
please help me on this I want blank cell for "dbnull.value"
What I have tried:
Dim dt As New DataTable
GridView1.DataSource = dt
dt.Columns.Add("acno", GetType(String))
dt.Columns.Add("particulars", GetType(String))
dt.Columns.Add("amount", GetType(Double))
dt.Columns.Add("chequenumber")
dt.Columns.Add("chequedate")
Dim ses As String
ses = ""
If RadioButton1.Checked = True Then
ses = "1C"
ElseIf RadioButton2.Checked = True Then
ses = "2C"
End If
If Val(TextBox1.Text) <> 0 Then
dt.Rows.Add(ATMISS, "NFS " & TextBox19.Text & "-" & ses, -1 * TextBox1.Text, DBNull.Value.ToString, DBNull.Value.ToString)
End If
If TextBox11.Text <> 0 Then
dt.Rows.Add(NPCIEXP, "NFS " & TextBox19.Text & "-" & ses, Math.Round(-1 * TextBox11.Text, 2), DBNull.Value.ToString, DBNull.Value.ToString)
End If
If TextBox4.Text <> 0 Then
dt.Rows.Add(ATMACQ, "NFS " & TextBox19.Text & "-" & ses, TextBox4.Text, DBNull.Value.ToString, DBNull.Value.ToString)
End If
If TextBox14.Text <> 0 Then
dt.Rows.Add(NPCIINC, "NFS " & TextBox19.Text & "-" & ses, TextBox14.Text, DBNull.Value, DBNull.Value)
End If
If TextBox5.Text <> 0 Then
dt.Rows.Add(ATMADJ, "ADJUSTMENT " & TextBox19.Text & "-" & ses, -1 * TextBox5.Text, DBNull.Value, DBNull.Value)
End If
If TextBox15.Text <> 0 Then
dt.Rows.Add(NPCIEXP, "ADJUSTMENT " & TextBox19.Text & "-" & ses, -1 * TextBox15.Text, DBNull.Value, DBNull.Value)
End If
If TextBox6.Text <> 0 Then
dt.Rows.Add(ATMADJ, "ADJUSTMENT " & TextBox19.Text & "-" & ses, TextBox6.Text, DBNull.Value, DBNull.Value)
End If
If TextBox16.Text <> 0 Then
dt.Rows.Add(NPCIINC, "ADJUSTMENT " & TextBox19.Text & "-" & ses, TextBox16.Text, DBNull.Value, DBNull.Value)
End If
If TextBox9.Text <> 0 Then
dt.Rows.Add(ATMSTL, "NFS " & TextBox19.Text & "-" & ses, TextBox9.Text, DBNull.Value, DBNull.Value)
End If
If TextBox10.Text <> 0 Then
dt.Rows.Add(ATMSTL, "NFS " & TextBox19.Text & "-" & ses, -1 * TextBox10.Text, DBNull.Value.ToString, DBNull.Value.ToString)
End If
GridView1.DataBind()
ExportToExcel()