Reputation: 11
I am using Nonfactors.Grid.Mvc(6.2.4)
and trying to show data in table. I have also included styles
and js
file in layout as well,
But data is not showing , even table is now showing.
View
@using NonFactors.Mvc.Grid
@model IQueryable<Student>
@{
ViewBag.Title = "Students List";
}
<div class="panel">
<div class="panel-body">
@(Html
.Grid(Model)
.Build(columns =>
{
columns.Add(model => model.Name).Titled("Name");
columns.Add(model => model.Address).Titled("Surname");
columns.Add(model => model.Email).Titled("Marital status");
columns.Add(model => model.GPA).Titled("Age");
columns.Add(model => model.Major).Titled("Birthday");
columns.Add(model => model.Minor).Titled("Employed");
})
.Empty("No data found")
.Filterable()
.Sortable()
.Pageable()
)
</div>
Controller method
[HttpGet]
public ViewResult LoadStudents()
{
List<Student> students = (from Student in this.Context.Students
select Student).ToList();
var queryable = students.AsQueryable();// i debug and see data is populating in this
return View(Context.Set<Student>());
}
I also use inspect element and check console errors but no error showing as well. I have install gridmvc through package manager. No error showing, even build successfully but no data is showing,
Upvotes: 0
Views: 1153
Reputation: 2408
You should following steps in below link: https://aspnet-core-grid.azurewebsites.net/installation
Consider the steps of the photo while reading.
document.querySelectorAll(".mvc-grid").forEach(element => new MvcGrid(element));
Upvotes: 0
Reputation: 949
Do you use asp.net core mvc or asp.net mvc?
Nonfactors.Grid.Mvc(6.2.4) is for ASP.NET MVC projects.
Make sure the script is correctly referred.
If you using asp.net mvc, you can also try Grid.Mvc, it can work on my site:
https://www.codeproject.com/Tips/597253/Using-the-Grid-MVC-in-ASP-NET-MVC
Result like:
Upvotes: 0