I am trying to load a datagridview with a paginated list but the result is as in the image shown. However, when I populate the datagridview with the datatable from which I am converting to a pagedlist, the data is displayed correctly (unpaginated though). Kindly help resolve this. The Error populated DGV
This is what i have tried:
IPagedList<DataRow> list;
public async void PopulateDGV(DataTable myDT)
{
list = await GetPagedListAsync(myDT);
myDGV.DataSource = list.ToList(); //This part populates as in the image, but when I populate it with 'myDT', it works fine
}
public async Task<IPagedList<DataRow>>GetPagedListAsync(DataTable dt, int pageNumber = 1, int pageSize = 10)
{
return await Task.Factory.StartNew(() =>
{
return dt.AsEnumerable().ToPagedList(pageNumber, pageSize);
});
}