Microsoft Chart Controls Assembly reference: howto move it to web.config
Currently, when I want to use Microsoft Chart Controls on a website, I need to add the following onto every aspx page where I want to use it:
<%@ Register Assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %>
Is there any way to move this to the web.config file开发者_运维问答, so that I don't have to put it on every page ?
Have you checked the web.config? Whenever i've dragged a chart control onto a page, it's added the correct assemblies in web.config automatically. The only time it doesn't do this is when it's in an MVC project.
If you are using MVC, check out this post on how to integrate the charts with an MVC project
You can add like this:
<configuration>
<system.web>
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</controls>
</pages>
</system.web>
</configuration>
For detailed information: http://msdn.microsoft.com/en-us/magazine/dd453008.aspx
精彩评论