I've been trying solution I've found oline all day trying to get a GridView to Display its Header when its datasource returns 0 rows. So far, nothing has worked for me. I did come across an interesting bit of code, but I'm having a spot of bother with something else preventing me from getting it to work.
#region --Empty Grid Fix--
public static void EmptyGridFix(GridView grdView)
{
// normally executes after a grid load method
if (grdView.Rows.Count == 0 && grdView.DataSource != null)
{
System.Data.DataTable dt = null;
// need to clone sources otherwise it will be indirectly adding to the original source
if (grdView.DataSource is DataSet)
{
dt = ((DataSet)grdView.DataSource).Tables[0].Clone();
}
else if (grdView.DataSource is System.Data.DataTable)
{
dt = ((Syste ...
Go to the complete details ...