webgrid reference is not found in view
Solution 1
- Just add reference to System.Web.Helpers 2.0.0.0 dll which Basic template does not include by default.
- After adding the reference, you need to open property for the dll and change Copy Local to True.
- Rebuild your project
Solution 2
I was able to solve this by updating the reference to the helper dll and setting the copy local to true to overwrite the old version. I somehow had a bad version get referenced, possibly through an old nuget package.
gleasonomicon
Updated on June 26, 2022Comments
-
gleasonomicon about 2 years
I'm trying to do a basic implementation of the asp.net mvc webgrid mentioned in this tutorial: http://msdn.microsoft.com/en-us/magazine/hh288075.aspx
I'm using asp.net mvc 4.
Upon doing a simple reference to the grid (the first part of the tutorial), I'm getting this error in the view:
Compiler Error Message: CS0246: The type or namespace name 'WebGrid' could not be found (are you missing a using directive or an assembly reference?)
The code for the cshtml file is below:
@model IEnumerable<Company.Core.DataAccess.Models.TransactionLog> @{ ViewBag.Title = "Index"; } @{ var grid = new WebGrid(Model, defaultSort:"TransactionLogId"); } @grid.GetHtml() @section Scripts { @Scripts.Render("~/bundles/jqueryval") }
I have a reference to System.Web.Helpers. If I put an @using directive for it in the view, the same message remains. Can anyone help out?