Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1170
datatable as datasource for Iggrid
posted

I'm using Data Table as data source for IgGrid.  When I'm trying to do remote sorting I'm getting error

ArgumentNullException: Value cannot be null.

System.Linq.Expressions.Expression.Property(Expression expression, PropertyInfo property) +6153565
Infragistics.Web.Mvc.SortingExtensions.ApplyOrder(IQueryable source, String property, String methodName)

I'm converting data table into IQueryable<Object> like this

List<Dictionary<stringobject>> rows = new List<Dictionary<stringobject>>();
Dictionary<stringobject> row = null;
 
foreach (DataRow dr in dataTable.Rows)
{
    row = new Dictionary<stringobject>();
    foreach (DataColumn col in dataTable.Columns)
        row.Add(col.ColumnName, dr[col] == DBNull.Value ? string.Empty : dr[col]);
 
    rows.Add(row);
}
return rows.AsQueryable<object>();

Here I cannot map my datatable into any specific model because datatable columns are getting change with input request.

Please suggest anyway to do remote sorting with data table as data source without creating any static model class.

Thanks!
Manish