I'm customizing the columns I need for a datagrid in DevExtreme. Below is my Index.cshtml and my action method to load the data. The model has more attributes but I only want to include these three.
@(Html.DevExtreme().DataGrid<ServicingRequestOrder.Models.GeneralInfo>
()
.ID("dataGrid")
.ShowBorders(true)
.DataSource(d => d.Mvc().Controller("GeneralInfo").LoadAction("IndexLoad").Key("ID"))
.Columns(columns =>
{
columns.AddFor(m => m.CustomerID);
columns.AddFor(m => m.Name);
columns.AddFor(m => m.Description);
}).
[HttpGet]
public object IndexLoad(DataSourceLoadOptions loadOptions)
{
var generalInfos = _context.GeneralInfos.ToList();
return DataSourceLoader.Load(generalInfos, loadOptions);
}
The specific exception I'm getting is
TypeLoadException: Could not load type 'Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ExpressionHelper' from assembly 'Microsoft.AspNetCore.Mvc.ViewFeatures, Version=3.1.7.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
I have included this service in my Startup.cs as well.
services.AddMvc().AddJsonOptions(options => options.JsonSerializerOptions.PropertyNamingPolicy = null);
What am I missing here.
The issue is resolved. By default when I installed Devextreme in the dependencies, it wasn't the latest version. After some checking, I had to update the version of Devextreme and it's all good now.