If you open the Web.Config inside the Views folder, you can add namespaces there as well, so you don't have to add the using
to the top of any Views.
However, at the top of your Razor view, don't forget the syntax is @using
, not just using
, which may be the reason that it's not working for you.
EDIT
Inside your Web.config (again, the one inside the Views folder, not the one at the bottom of the project), you can add additional namespaces in the following location:
<system.web.webPages.razor>
<host... />
<pages>
<!-- These are added by default when you create the MVC project -->
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization"/>
<add namespace="System.Web.Routing" />
<!-- Add your additional namespaces here -->
</pages>
</system.web.webPages.razor>
This section is towards the top, just below the <configSections>
area. (The project I have is on line 11 without having added anything to the file above it.
As a side note, if you're using Visual Studio 2010, I typically need to close all of my views and then restart Visual Studio to get it to update those. Keep that in mind if it doesn't work immediately.