try with this. My english is poor ok?
Public Sub CheckEmptyGrid(ByVal grid As WebControls.GridView)
If grid.Rows.Count = 0 And Not grid.DataSource Is Nothing Then
Dim dt As Object = Nothing
If grid.DataSource.GetType Is GetType(Data.DataSet) Then
dt = New System.Data.DataSet
dt = CType(grid.DataSource, System.Data.DataSet).Tables(0).Clone()
ElseIf grid.DataSource.GetType Is GetType(Data.DataTable) Then
dt = New System.Data.DataTable
dt = CType(grid.DataSource, System.Data.DataTable).Clone()
ElseIf grid.DataSource.GetType Is GetType(Data.DataView) Then
dt = New System.Data.DataView
dt = CType(grid.DataSource, System.Data.DataView).Table.Clone
End If
dt.Rows.Add(dt.NewRow())
grid.DataSource = dt
grid.DataBind()
grid.Rows(0).Visible = False
grid.Rows(0).Controls.Clear()
End If
End Sub
and the call
CheckEmptyGrid(Grid)
With this the headers appers ok