I've got a gridview that is bound to a dataview in the codebehind. The datasource is actually powershell, so I'm processing the data myself. This works fine and displays the result how I want. However, when I try to enable paging, I get this error when opening the page:
The table must contain row sections in order of header, body, then footer.
Any idea why this is happening?
Heres the code for my binding:
mbGrid.DataSource = MailBoxManager.Instance.getDataTable();
mbGrid.EnableSortingAndPagingCallbacks = true;
mbGrid.AllowPaging = true;
And the code that populates the datatable is:
public DataTable getDataTable()
{
DataTable dt = new DataTable();
dt.Columns.Add(new DataColumn("Name", typeof(string)));
dt.Columns.Add(new DataColumn("Email", typeof(string)));
foreach (Mailbox mb in MbList)
{
DataRow dr;
dr = dt.NewRow();
dr["Name"] = mb.Name;
dr["Email"] = mb.PrimaryEmail;
dt.Rows.Add(dr);
}
return dt;
}