EmptyDataGrid - Bug

I was working with my EmptyDataGrid control on a project at work today, when I noticed a bug that could affect just about anyone using it. It turns out that if you have Paging turned on, and no data is returned, the EmptyTemplate gets appended to the DataGrid after the Pager item.

Therefore, a workaround is in need, so before you bind to the EmptyDataGrid, run this check:

[VB.NET]
If DataSet1.Tables(0).Rows.Count = 0 Then
  EmptyDataGrid1.AllowPaging = False
Else
  EmptyDataGrid1.AllowPaging = True
End If

[C#]
if(DataSet1.Tables[0].Rows.Count == 0)
{
    EmptyDataGrid1.AllowPaging = false;
}
else
{
    EmptyDataGrid1.AllowPaging = true;
}

I've noted this bug to be fixed in the next version.

No Comments