Reputation: 297
I'm trying to use the Chart control in asp.net 4.0. While I know it required a separate install as part of 3.5, it's included by default with 4.0.
I can see the Chart control in my toolbox, and I can drag it to my designer and see a preview of the chart. However, when I try to compile my website, I get an error stating:
The type or namespace name 'DataVisualization' does not exist in the namespace 'System.Web.UI' (are you missing an assembly reference?)
I receive the same error when I take a brand new page and add the following:
using System.Web.UI.DataVisualization;
Any ideas? I can understand why I would get this error in 3.5, but no clue why I would receive in 4.0, especially when I can see the control in the toolbox.
Upvotes: 9
Views: 53814
Reputation:
Try looking in Program Files\Microsoft Chart Controls\Assemblies
.
Upvotes: 0
Reputation: 11
In case you missed, just add the System.Web.Extensions
reference to your project, and it will solve your problems.
Upvotes: -3
Reputation: 101
Click on Add References in your project and Browse to C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0
and add the System.Web.DataVisualization dll
file.
Before adding the dll remove the previous one and make sure that change the Target Frameweok to V4.0 in the project properties.
This will solve your problem.
Upvotes: 10
Reputation: 377
Click on Add References in your project and in the .NET Components tab add the System.Web.DataVisualization. This should solve your problem.
Upvotes: 31
Reputation: 297
When I upgraded my website from .net 3.5 to 4.0, some of the references in my web.config didn't automatically get updated to 4.0. After I manually updated them, everything worked.
Upvotes: 3