User (Legacy) Posted May 17, 2004 Report Share Posted May 17, 2004 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? Thanks CM <%@ 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) { base.OnInit(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; Chart1.CloseData(SoftwareFX.ChartFX.COD.Values); } 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; } } </script> <form runat="server"> <%= Chart1.GetHtmlTag("500","350",".NET")%> </form> Link to comment Share on other sites More sharing options...
Software FX Posted May 17, 2004 Report Share Posted May 17, 2004 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. -- FP Software FX Link to comment Share on other sites More sharing options...
sunil.gore84 Posted February 12, 2013 Report Share Posted February 12, 2013 Hi, I m using ChartFx inside CotentPlaceHolder but my click event is working only on one page but itz not working on another page. all the code is same for both the pages and charts. Can u plz suggest what is the issue? Regards Sunil Gore Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.