Empty GridView....

Topics: Developer Forum
Apr 4, 2007 at 6:00 PM
When the frozen header gridview is empty, the frozen gridview is not working, the page is blowing out. how can i fix this?

thanks in advance,

Murthy here
Sep 11, 2007 at 9:04 PM
I know this is an older post, but may be this will help someone else or someone will show me a better way. But if my dataset has no rows I run down this path of logic:

If ds.Tables(0).Rows.Count = 0 Then

If ds.Tables(0).Columns.Count = 0 Then
ds.Tables(0).Columns.Add("Col001")
ds.Tables(0).Columns.Add("Col002")
ds.Tables(0).Columns.Add("Col003")
.........
End If

Dim dr As DataRow
dr = ds.Tables(0).NewRow()

dr.Item("Col001") = " -- "
dr.Item("Col002") = " -- "
dr.Item("Col003") = System.DBNull.Value

ds.Tables(0).Rows.Add(dr)
ds.AcceptChanges()

Return ds

End If