Are you binding to a datatable or a dataset? The code below seems to product
the header with no data:
Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
Dim dt As New DataTable
dt = CreateDataSource()
If dt.Rows.Count = 0 Then
End If
DataGrid1.DataSource = dt
DataGrid1.DataBind()
End Sub
Function CreateDataSource() As DataTable
Dim dt As New DataTable
Dim dr As DataRow
dt.Columns.Add(New DataColumn _
("IntegerValue", GetType(Int32)))
dt.Columns.Add(New DataColumn _
("StringValue", GetType(String)))
dt.Columns.Add(New DataColumn _
("CurrencyValue", GetType(Double)))
dt.Columns.Add(New DataColumn _
("Boolean", GetType(Boolean)))
'Dim i As Integer
'For i = 0 To 8
' dr = dt.NewRow()
' dr(0) = i
' dr(1) = "Item " + i.ToString()
' dr(2) = 1.23 * (i + 1)
' dr(3) = (i = 4)
' dt.Rows.Add(dr)
'Next i
Return dt
End Function 'CreateDataSource