Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Namespace issue with MVC view - Razor engine

I added reference to the System.Web.DataVisualization to my MVC project. Now when I try to add the namespace to my web.config I am getting error

CS0234: The type or namespace name 'DataVisualization' does not exist in the namespace 'System.Web.UI' (are you missing an assembly reference?)

So then I try to use the same in my controller. This works perfectly.

using System.Web.UI.DataVisualization;

Then the same should work in my Razor view

So I try to use this in my Razor view

@using System.Web.UI.DataVisualization;

This again not not work giving me the same error

How come I can use the namespace in my controller and not in my views?

Am I missing something...

like image 739
Sarath Avatar asked Feb 26 '11 15:02

Sarath


1 Answers

If you go to the project references, go to properties on "System.Web.DataVisualization," then set "CopyLocal" to true, you'll then be able to put

@using System.Web.UI.DataVisualization

in your Razor view.

like image 163
dankorz Avatar answered Oct 30 '22 19:10

dankorz