In C# how do I still show the headers of a gridview, even with the data source is empty.
I am not auto generating the columns as they are all predefined.
C
You can set the ShowHeadersWhenNoRecords property of the ownertableview to true. aspx:
Also when the datasource for the GridView is null(when no records), you can try setting it as shown below: c#:
if (GridView1.DataSource == null) { GridView1.DataSource = new string[] { }; } GridView1.DataBind();