Jump to content
Software FX Community

Can't get Chart.Click event working

User (Legacy)

Recommended Posts

I can't get the Chart.Click event to work in my ASP.NET chart FX page. 

The event handler is not getting executed. Any ideas?

Here is a standalone aspx demonstrating the problem. What do I need to

do differently?



<%@ Page Language="C#" AutoEventWireup="True" Debug="True" %>

<%@ Import Namespace="SoftwareFX.ChartFX.Internet.Server"%>

<%@ Import Namespace="System.Drawing"%>

Welcome to my first .aspx page that contains a chart:

<script runat="server">

protected SoftwareFX.ChartFX.Internet.Server.Chart Chart1;

protected override void OnInit(EventArgs args) {


Chart1 = new SoftwareFX.ChartFX.Internet.Server.Chart(this);

Chart1.Click += new MouseEventHandlerX(OnClick);


protected override void OnPreRender(EventArgs args) {

Chart1.OpenData(SoftwareFX.ChartFX.COD.Values, 1, 8);

Chart1.Value[0, 0] = 0.0;

Chart1.Value[0, 1] = 0.1;

Chart1.Value[0, 2] = 0.2;

Chart1.Value[0, 3] = 0.3;

Chart1.Value[0, 4] = 0.4;

Chart1.Value[0, 5] = 0.5;

Chart1.Value[0, 6] = 0.6;

Chart1.Value[0, 7] = 0.7;



void OnClick(object sender, MouseEventArgsX args) {

int seriesIndex = args.Series;

int pointIndex = args.Point;

if (seriesIndex > -1 && pointIndex > -1) {

Chart1.Point[seriesIndex, pointIndex].Color = Color.Red;




<form runat="server">

<%= Chart1.GetHtmlTag("500","350",".NET")%>


Link to comment
Share on other sites

In order for the event to be fired back to the server you must have the

chart inside a WebForm (this applies to any WebForms component).

Without the Page infrastructure it is just not possible to send events back

to the server. In your case the chart is not a child control of the page,

hence the chart can not ask the page for its postback address and the page

can not find the chart when the PostBack is received to hand the control to

the appropriate event.

Bottom-line: you need to make your page a WebForm, with the chart being part

of the control tree. The easiest way to do this is to use Visual Studio, I

guess you can find documentation on how to this manually in MSDN.



Software FX

Link to comment
Share on other sites

  • 8 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...