Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.Web.UI.DataVisualization.Charting missing error in .net 4.0?

Tags:

c#

asp.net

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.

like image 415
Mike Avatar asked Jul 18 '11 04:07

Mike


3 Answers

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.

like image 159
Jeyaprakash Avatar answered Nov 12 '22 21:11

Jeyaprakash


Click on Add References in your project and in the .NET Components tab add the System.Web.DataVisualization. This should solve your problem.

like image 29
Anand Satyan Avatar answered Nov 12 '22 22:11

Anand Satyan


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.

like image 38
Mike Avatar answered Nov 12 '22 23:11

Mike