javascript - Error populating a kendo grid using Json -


i'm trying fill kendo grid controller, datasource has entity class can null in cases. work well, except when entity has null value.

    [httppost]     public actionresult read([datasourcerequest] datasourcerequest request, filter val)     {         list<incidencia> vobj = _casosservice.getdatos();          if (null != val.desc && val.desc.length > 0)             vobj = vobj.where(o =>                     o.description.tolower().contains(val.desc.tolower()) ||                     o.tittle.tolower().contains(val.desc.tolower())                                         .tolist();          return json(vobj.orderbydescending(o => o.date).todatasourceresult(request, o => new            {                o.id,                o.eventdate,                o.description,                o.system.shortname,                o.tittle,                o.iduserreport,                o.close,                o.closedate,                o.customers.shortname // <-- throw exception if has null value.            })  );     } 

i appreciate help.

why not following?

  o.customers != null ?   o.customers.shortname  : ""  

Comments