Monday, 6 August 2012

Asp.Net Bind MSChart with Dataset and handle Click event of the chart


Introduction       
                  
        This tutorial uses the new MS Chart click event to render a column graph from a Data Table in C# and ASP.NET 2.0 to 4.0

Description
In this tutorial, we will be looking at the new addition to the .NET Framework, MS Charts click event. We will be rendering a bar chart from a Data Table and then click event of that bar chart, and show just how easy.
Before we begin anything, and even start up Visual Studio.NET, we first need to download and install the Chart extension. You can download from the above web address, and the install is a quick process - consisting of two axes. Once installed, we can start up Visual Studio and create a new Web Application. Then the first thing to do is add two references in the Web.config:
In system.web/http Handlers, add the following:
<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>





Downloads  
You can download the complete source code in Asp.net C# 
 

6 comments:

Aashey said...

Hello everyone,
I am facing a strange problem, i have a case in which i have to generate a pie chart using MS Chart control in asp.net. (see the files attached ) . i do it in code behind i.e at run time. Chart get plotted well but problem arise when i click on any segment of pie for further drill down of that set of data. the 1st chart whose click event was fired get cleared up i.e nothing is shown in the chart as displayed but new chart get plotted on the value of post back value bind at run time. so to display chart image i have to call the event which builds the 1st chart again. similary when i try to click on chart2 to generate chart3. chart2 image gets cleared up. i am attaching image files and chart control & its code behind.

Unknown said...

thanks nice share :)

Unknown said...

Where is your use of DataSet?

Unknown said...

Good post about ASP(.) NET. asp.net is a more useful programming language in development. Keshri software solution is a web design and web development company in kolkata and also live project training institute.


Please visit : http://training.ksoftware.co.in/ for more details.

Bangaloreweb guru said...

Thank you for sharing this post about the best techniques for PHP Development, This is very useful for PHP Development and PHP Development Company.Web Development Bangalore | Web Designing Bangalore

Unknown said...

nice and informative post thanks for sharing and keep it up
SEO Experts India

SEO Specialist in Bangalore
cheapest seo packages

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Powered by Blogger