You can create an extension method, that would see if no records are there, then add a row, that would say "no records found". For instance like:
your grid.ValidateRecords();
or you can add the extension method at the data source level. For instance like:
public static class Extensions
{
public static DataSet HasData(this DataSet ds)
{
if (ds == null || ds.Tables.Count < 1 || ds.Tables[0].Rows.Count < 1)//add more validation, if dataset is not null?
{
DataTable dt = new DataTable("Table1");
dt.Columns.Add("Col1");
DataRow dr = dt.NewRow();
dr["Col1"] = "No records found";
dt.Rows.Add(dr);
ds.Tables.Add(dt);
}
return ds;
}
}
Usage:
gridView1.DataSource = myDataSet.HasData();
Output:
