Quantcast
Viewing latest article 21
Browse Latest Browse All 644

GridView - Show headers on empty data source.

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.

Currently what I am doing is the following.

Get a DataTable back from a stored procedure, then set the DataSource of the gridview, and then call DataBind().

This works fine when I have data, but when no rows are returned then I just get a blank spot where the grid should be.


Viewing latest article 21
Browse Latest Browse All 644

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>