Using the ASP.NET 3.5 Chart control in MVC applications
Posted: (EET/GMT+2)
Microsoft has developed an ASP.NET 3.5 compatible charting control, which can also be used in ASP.NET MVC application. However, even after you install the control from the installation package, and it appears on the Visual Studio toolbox (after installing the tooling support), you cannot directly use the control in MVC applications.
If you try to use the control, you might get the error message "Error executing child request for ChartImg.axd". Luckily, this problem is very easy to solve by adding a single entry to your application's web.config file.
Here's the row you need to add to the httpHandlers section (splitted into multiple lines for readability):
<add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
Once you have added this line to the config file, the control will start to work properly.