Check with the source before binding to
datagridview
Like if you're using
DataTable
to bind datagridview then you can use following procedure.
foreach(DataRow row in dt.Rows)
{
bool IsEmpty = false;
foreach (object obj in row.ItemArray)
{
if (String.IsNullOrEmpty(obj.ToString()))
{
IsEmpty = true;
}
else
{
IsEmpty = false;
}
}
if (IsEmpty)
{
dt.Rows.Remove(row);
}
}
Thanks.