Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
110
ChartDataClicked not called inside a webpart
posted

 I am testing UltraChart inside a SharePoint webpart. I have the chart working, now I want to react to a data-click (I am not using the drilldown feature).

The code snippit below shows the chart creation and event delegate set inside CreateChildControls as recommended. The problem is that when the chart is clicked, CreateChildControls is called again and the delegate is assigned again and so the event method is never called.

 Is there a better place in the life cycle to attach the event delegate? Or have I got it all completely wrong? Any suggestions will be greatly appreciated.

Cheers,

Jim. 

        protected override void CreateChildControls()
        {
            _chart = new UltraChart();
            _chart.ID = "mychart";
            _chart.ChartDataClicked += new Infragistics.UltraChart.Shared.Events.ChartDataClickedEventHandler(_chart_ChartDataClicked);
           ****** databind etc
            Controls.Add(_chart);
        }

        void _chart_ChartDataClicked(object sender, Infragistics.UltraChart.Shared.Events.ChartDataEventArgs e)
        {
            throw new Exception("The method or operation is not implemented.");
        }