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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Filtering ForeignKey field raises an exception

Thread ID:





123329 Mar 8,2016 03:28 PM UTC Mar 10,2016 04:04 AM UTC ASP.NET MVC 3
Tags: Grid
Omar Muscatello
Asked On March 8, 2016 03:28 PM UTC

Hello Syncfusion Team,
I'm working with the Grid control.

The grid show a nested entity throught:

col.Field(x => x.Categoria.Id).HeaderText("Categoria")

I want to filter this column (filtering is enabled in grid).

When I write something on the filter textbox the action called is:

        public JsonResult Lista(DataManager dm)
            using (DataDbContext db = new DataDbContext())
                IEnumerable data = db.Pazienti;
                DataOperations operation = new DataOperations();
                data = operation.Execute(data, dm);
                List<PazienteViewModel.Index> result = data.Cast<Paziente>().AsQueryable().OrderBy(x => x.Cognome).ThenBy(x => x.Nome).ProjectToList<PazienteViewModel.Index>();

                return Json(new { result, count = result.Count });

Executing this code, I get an exception on the highlighted line.

System.NullReferenceException non è stata gestita dal codice utente
  Message=Riferimento a un oggetto non impostato su un'istanza di oggetto.
       in Syncfusion.JavaScript.DataSources.DataOperations.PerformWhereFilter(IEnumerable dataSource, List`1 whereFilter, String condition)
       in Syncfusion.JavaScript.DataSources.DataOperations.Execute(IEnumerable dataSource, DataManager manager)
       in PazientiController.Lista(DataManager dm) in PazientiController.cs:riga 36
       in lambda_method(Closure , ControllerBase , Object[] )
       in System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
       in System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
       in System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
       in System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState)
       in System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult)
       in System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
       in System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
       in System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d()
       in System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()

How can I solve this problem? What am I doing wrong?

Gowthami V [Syncfusion]
Replied On March 9, 2016 09:24 AM UTC

Hi Omar,

We have analyzed your issue and we are unable to reproduce the issue.

For your reference we have attached the sample (version below,


Please provide us below details to reproduce the issue.

1.       Share the code example used for grid rendering.

2.       Share the version details that you have used.

3.       Reproduce the issue in the above sample.

The provide information will help to analyze the issue and provide you the response as early as possible.


Gowthami V.

Omar Muscatello
Replied On March 9, 2016 05:20 PM UTC

Thank you Gowthami V.

Comparing your example with mine I found the problem.

I have to use x.IdCategoria and not x.Categoria.Id

So I think that there is a problem with nested entities.

Thank you again.

Gowthami V [Syncfusion]
Replied On March 10, 2016 04:04 AM UTC

Hi Omar,
We are happy to hear that your issue has been resolved.
Get back to us if you need further assistance.
Gowthami V.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon