This question is locked. New answers and comments are not allowed.
Hi,
I have several methods in my data layer which return strong typed DataTable objects.
I have successfully using the MVC Grid converting my strong typed DataTable objects to non typed DataTables, now I want to use a custom logic for the pagination so I retrieve from the DB only the rows I need and not all of them but I have realized I can't because the Data object in the GridModel constructor only accept IEnumerable lists and not DataTable objects:
return View(new GridModel
{
Data = myData,
Total = myTotal
})
If I try to convert my DataTable to IEnumearble<System.Data.DataRow> or IEnumerable<dynamic> a new error appears when a column in the row has null value, throwing an exception that a conversion from Null to string is not possible, any idea?
Thanks in advance.
I have several methods in my data layer which return strong typed DataTable objects.
I have successfully using the MVC Grid converting my strong typed DataTable objects to non typed DataTables, now I want to use a custom logic for the pagination so I retrieve from the DB only the rows I need and not all of them but I have realized I can't because the Data object in the GridModel constructor only accept IEnumerable lists and not DataTable objects:
return View(new GridModel
{
Data = myData,
Total = myTotal
})
If I try to convert my DataTable to IEnumearble<System.Data.DataRow> or IEnumerable<dynamic> a new error appears when a column in the row has null value, throwing an exception that a conversion from Null to string is not possible, any idea?
Thanks in advance.