Wednesday, February 18, 2009

How to use <asp:chart> Chart Control in ASP.NET

Microsoft has released the Free Chart Controls (which are based on the Dundas Chart Controls). Chart and graphs play an important role when modeling and analyzing the data. These chart controls provide rich user experience with a wide variety of advance functionality such as drill down charts, Click events on charts and it's components etc. Another best thing is it works fine with ASP.NET MVC. You can find the screen shots of these rich controls below:





Download links for the ASP.NET Charts:

* Download the Free Microsoft Chart Controls
* Download the VS 2008 Tool Support for the Chart Controls
* Download the Microsoft Chart Controls Samples
* Download the Microsoft Chart Controls Documentation

Steps to make it work:
Edit the Web.Config
To enable the controls you have to edit the web.config file.
Add this under the controls tag (path: "<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"
/>

And add this httpHandler (under "<httphandlers>") :
<add path="ChartImg.axd" verb="GET,HEAD"
type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler,
System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"
validate="false"/>
You are set to Go!!!
Hope this helps you!

0 comments:

Post a Comment