Pages

Thursday, 12 September 2013

MS Chart Control in ASP.net 4.0 Error

After Creating Webapplication in VS 2010 and using Chart control you will Receive Following Errors Unknown server tag 'asp:chart'. 
Visual Studio 2010 with .NET 4.0 not recognising System.Web.UI.DataVisualization.Charting

to Remove this error  you need to make few changes in Web,config
Step 1:
Find the <system.web> Section in Web,config and make changes in 3 sections given below

<httpHandlers>
 <add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/> </httpHandlers>
<pages>
 <controls> <add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </controls>
 </pages>
 <compilation debug="true" targetFramework="4.0">
 <assemblies> <add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </assemblies>
 </compilation>

Step 2: 
After This Find section <system.webServer>

and replace or merge with following contents

<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
<remove name="ChartImageHandler"/>
<add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</handlers>
</system.webServer>

Step 3:
Add Reference for  System.Web.DataVisualization.dll



No comments:

Post a Comment