Search code examples
c#asp.net-mvcmodel-view-controllerrazorrazor-pages

MVC 5 Nonfactorsgrid is not working. Something is wrong withing the namespace


@using AspNetMvcActiveDirectoryOwin.Web.Common.Models.Users
@model IEnumerable<UserSearchModel>

@(Html
        .Grid(Model)
        .Build(columns =>
        {
            columns.Add(model => model.Name).Titled("Name");
            columns.Add(model => model.Surname).Titled("Surname");
            columns.Add(model => model.MaritalStatus).Titled("Marital status");

            columns.Add(model => model.Age).Titled("Age");
            columns.Add(model => model.Birthday).Titled("Birthday").Formatted("{0:d}");
            columns.Add(model => model.IsWorking).Titled("Employed");
        })
        .Empty("No data found")
        .Filterable()
        .Sortable()
        .Pageable()
        )

I am using Nonfactors grid for MVC 5 asp and I have installed it from the NuGet package manager but whenever i am trying to implement the grid in Razor it gives me this error:

HtmlHelper>' does not contain a definition for 'Grid' and no extension method 'Grid' accepting a first argument of type 'HtmlHelper>' could be found (are you missing a using directive or an assembly reference?)

I have really tried everything I can, but no luck so far. Any help would be much appreciated.


Solution

  • I think you are supposed to import the namespace in your HTML file.

    @using NonFactors.Mvc.Grid;