HtmlHelper does not contain a definition for 'Grid'

Dec 25, 2012 at 10:45 AM
Edited Dec 25, 2012 at 10:46 AM

I added GridMvc to my MVC4 web project using nuget. I can see reference to GridMvc.dll in project references, but cannot create grid:

@model List<string>
............ @Html.Grid(Model);

Result error:

Compiler Error Message: CS1061 ' System.Web.Mvc.HtmlHelper>' does not contain a definition for 'Grid' and no extension method 'Grid' accepting a first argument of type 'System.Web.Mvc.HtmlHelper>' could be found (are you missing a using directive or an assembly reference?)

 

How to fix it?

Coordinator
Dec 25, 2012 at 11:09 AM

Hi,

Try to restart Visual Studio

Feb 5, 2013 at 8:12 PM
I'm getting the same error and restarting VS didn't solve it. Could u share how u overcame this issue? Tks
Feb 5, 2013 at 8:14 PM
Have you added '@using GridMvc.Html' to the view?
Feb 5, 2013 at 9:07 PM
Thank you, nosuchip. It happened that I didn't know custom html helpers very well. So, documenting: if one has this issue, add the using directive in the view or add the grid mvc assembly to the web.config file.