Jak korzystać z WebGrid w widoku cshtml?

Jestem w stanie użyćWebGrid w każdym kontrolerze, takim jak:

var grid = new WebGrid(emailsFetched, columnNames);

Musiałem dodać odwołanie w moim projekcie ASP.NET MVC doSystem.Web.Helpers dla tego.

Ale kiedy próbuję użyć tej siatki internetowejwidok bezpośrednio (aby uniknąć wystąpienia instancji i innych ustawień w kontrolerze) mówi:The type or namespace 'WebGrid' cannot be found. Ok, próbowałem też dodać tutaj odniesienie:

@using System.Web.Helpers ale to rzuca inny problem:

There is no build provider registered for the extension '.cshtml'. You can register one in the <compilation><buildProviders> section in the machine.config or web.config. Make sure is has a BuildProviderAppliesToAttribute attribute which includes the value 'Web' or 'All'.

To jest dość dziwne ... Widziałem wystarczająco dużo przykładów w sieci, które używają WebGrid i nie muszą niczego deklarować w widoku cshtml ...

Czy możesz mi powiedzieć, jak to rozwiązać? Albo dlaczego napotykam ten bardzo brzydki problem?

questionAnswers(3)

yourAnswerToTheQuestion