There are numerous example for C3 but I had to spend quite some time to adapt it to my project using VB.NET
Hope it can be of help to you.
I assume that you have
already added the GridMVC package from NUGET.
Here are step by step guide
Controller
No change needed , see a sample below,
Function Index() As ActionResult
Return View(db.Categories.ToList())
End Function
View
Add the following import at the top of your view
@imports GridMVC.html
You would need to reference the following also
Add the stylesheets (check the location after you install the GridMVC package)
<link href=”~/Content/Gridmvc.css” rel=”stylesheet” />
<link href=”~/Content/gridmvc.datepicker.min.css” rel=”stylesheet” />
For your paging support
Install the PagedList package also
Once you have installed this package then add the following reference to your view, this will help you format your paging buttons
properly.
<link href=”~/Content/PagedList.css” rel=”stylesheet” />
Add the following code for your Grid to appear – In the following examples my Model has three fields – CatId, CatName
and ParentCatId. Make changes to suit your needs.
@Html.Grid(Model).Columns(Function(columns)
columns.Add(Function(o) o.CatID).Titled(“Cat #“).SetWidth(40)
columns.Add(Function(o) o.CatName).Titled(“Category“).SetWidth(100)
columns.Add(Function(o) o.ParentCatID).Titled(“Parent Cat #“).SetWidth(40)
End Function
).WithPaging(10).Sortable(True)