I would like to show headers of a gridview which contains no data:
List<myData> datas = new List<myData>();
Gridview1.DataSource = datas.ToArray();
Gridview1.DataBind();
But then headers will be not shown. How can I show the headers in case the datas is empty?
I am still using .NET Framework 2.0, the server does not support .NET 4.0
Thanks in advance.
Check this one:
Show Grid view header and footer when the grid view is empty (with Generic List)
from your code I think the
.ToArray()call is not needed, a GridView should be able to bind also to the List directly.