mcintyre321/mvc.jquery.datatables

'Create' is not supported by the language

Closed this issue · 5 comments

I've installed the library using NuGet in my existing ASP.NET MVC5 application (.net 4.5) and started implementing it. However now I get a build error in my controller on the following code:

return DataTablesResult.Create(db.Products.Where(x => x.Status == 1).Select(m => new ProductModel() { Model = m.Model, UoM = m.UOM, Price = m.Price.ToString(), Size = m.Size, Category = m.ProductCategory.Description, ManufacturerProductNo = m.ProductNoManufacturer, Name = m.Description, SupplierProductNo = m.ProductNoSupplier, VAT = m.VATCode.VATPct.ToString() }), dataTableParam, uv => new { Name = "<b>" + uv.Name + "</b>" });

'Create' is not supported by the language

Any ideas?

It might be you have an old version referenced somewhere, check your
references match in each project ( maybe use asmspy.exe to see what's what,
sorry I'm on a bus at the moment, can't link!)
On 28 Nov 2015 17:08, "Glenn Vandamme" notifications@github.com wrote:

I've installed the library using NuGet in my existing ASP.NET MVC5
application (.net 4.5) and started implementing it. However now I get a
build error in my controller on the following code:

return DataTablesResult.Create(db.Products.Where(x => x.Status ==
1).Select(m => new ProductModel()
{
Model = m.Model,
UoM = m.UOM,
Price = m.Price.ToString(),
Size = m.Size,
Category = m.ProductCategory.Description,
ManufacturerProductNo = m.ProductNoManufacturer,
Name = m.Description,
SupplierProductNo = m.ProductNoSupplier,
VAT = m.VATCode.VATPct.ToString()
}), dataTableParam, uv => new
{
Name = "" + uv.Name + ""
});

'Create' is not supported by the language

Any ideas?


Reply to this email directly or view it on GitHub
#135.

bak-t commented

Hi,
after installing the latest version of library (1.3.26) via NuGet I faced the following issues:

  • method DataTablesResult.Create requires Mvc.JQuery.DataTables.Models.ArrayOutputType enum which is actually defined in Mvc.JQuery.Datatables.Models namespace
  • wrong namespace specified for DataTablesModelBinder in RegisterDatatablesModelBinder.cs (probably issue with RegisterDatatablesModelBinder.cs.pp template)

The first one is quite similar to mentioned by @Glennvd.

I've just pushed a new version where I've updated Datatables to DataTables everywhere - try updating to that, and check for the lower case t in your codebase.

bak-t commented

Thanks, it works!

P.S. For those who updates package & issue remains: you need manually update Mvc.JQuery.Datatables.Core to the latest version, since Mvc.JQuery.Datatables requires 1.0.0.0 of it in manifest & NuGet takes lowest version that dependency.

Glad to hear it. I'm going to close this, unless @Glennvd has any further issues.

Thanks for the PS - I've updated the nuspec to require exactly the same version, hopefully that should fox that issue.