We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Exception When using complex filtering + UrlAdaptor

I'm getting this error:
NullReferenceException: Object reference not set to an instance of an object.

Syncfusion.EJ2.Base.QueryableOperation.GetColumnType<T>(IQueryable<T> dataSource, string filterString, Type type)

Please help

This is my code:

private IQueryable<ContractListVM> GetContractsQuery()
            return _contractRepository.GetContracts()
                .OrderByDescending(x => x.CreatedOn)
                .Select(contract => new ContractListVM
                    ContractId = contract.ContractId,
                    ContractAmount = contract.ContractAmount,
                    ContractStatus = Enumeration.FromValue<ContractStatusEnum>(contract.ContractStatusId).Name,
                    CreatedOn = contract.CreatedOn.ToString("dd-MM-yyyy"),
                    ExpirationDate = contract.ExpirationDate.Value.ToString("s"),


public async Task<IActionResult> UrlDatasource([FromBody]DataManagerRequest dm)
            var query = GetContractsQuery();
            var operation = new QueryableOperation();
            var count = query.Count();

            if (dm.Search != null && dm.Search.Count > 0)
                query = operation.PerformSearching(query, dm.Search);  //Search
            if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting
                query = operation.PerformSorting(query, dm.Sorted);
            if (dm.Where != null && dm.Where.Any()) //Filtering
                foreach (var whereFilter in dm.Where)
                    if (whereFilter.IsComplex)
                        foreach (var whereFilterPredicate in whereFilter.predicates)
                            query = operation.PerformFiltering(query, dm.Where, whereFilterPredicate.Operator);
                        query = operation.PerformFiltering(query, dm.Where, dm.Where.First().Operator);

            var str = new List<string>();

            if (dm.Aggregates != null)
                str.AddRange(dm.Aggregates.Select(t => t.Field));

            var aggregate = operation.PerformSelect(query, str);

            if (dm.Skip != 0)
                query = operation.PerformSkip(query, dm.Skip);   //Paging
            if (dm.Take != 0)
                query = operation.PerformTake(query, dm.Take);

            var result = await query.ToListAsync();

            return dm.RequiresCounts 
                ? Json(new { result, count, aggregate }) 
                : Json(result);

Ui code: 

<ejs-grid id="ContractsGrid"
          toolbar="@(new List<string>() { "Search", "ExcelExport", "ColumnChooser" })"
    <e-grid-pagesettings pageSize="20"></e-grid-pagesettings>
    <e-data-manager url="@Url.Action("UrlDatasource", "ContractList")" adaptor="UrlAdaptor"></e-data-manager>
    <e-grid-filtersettings type="Excel" mode="Immediate"></e-grid-filtersettings>

1 Reply

SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team December 30, 2019 10:55 AM UTC

Hi Mohammed, 
Thanks for your update. 
We have considered this as a usability feature improvement “Problem with DataOperations when bind IQueryable data to Grid”, and logged a task for the same. 
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.  
We will include this feature in our any upcoming release. Until then we suggest you to bind List values to Grid to overcome the problem you are facing. 
Seeni Sakthi Kumar S 

Live Chat Icon For mobile
Up arrow icon