Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET Ajax Chart
Hi, I have a user control which contains an MSChart. I have a drop down list using which I want to select series that I have defined in the code behind. I have used Update Panels, both in the Chart Area as well as on the main .aspx page. After raising the "OnSelectedIndexChanged" event I used a Delegate to Update the UpdatePanel in the .aspx page as well as using Update() in the .ascx page. The chart does not refresh with the new series and just remains blank.
 
Here is the relevant code
 
.ascx file
protected void ChangeSeries(object sender, EventArgs e)
        {
            string series_selected = dd1.SelectedIndex.ToString();
 
                       
            switch (series_selected)
            {
                case ("Points"):
                    Series series1 = Chart1.Series[0];
                    this.FillStockDataPoints(series1, 5.0, DateTime.Now);
                    this.Chart1.Series["series1"].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Line;
                    Chart1.Series[0]["PixelPointWidth"] = "25";
                    _delUpdateControl.DynamicInvoke();
                   UpdatePanel1.Update() 
                    
                    break;
 
                case ("CSAT"):
                    Series series2 = Chart1.Series[1];
                    this.FillStockDataCSAT(series2, 5.0, DateTime.Now);
                    Chart1.Series[1]["PixelPointWidth"] = "25";
                    this.Chart1.Series["series2"].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Column;
                    _delUpdateControl.DynamicInvoke();
                    UpdatePanel1.Update()
                    break;
 
                case ("SLA"):
                    Series series3 = Chart1.Series[2];
                    this.FillStockDataSLA(series3, 5.0, DateTime.Now);
                    Chart1.Series[2]["PixelPointWidth"] = "25";
                    this.Chart1.Series["series3"].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Column;
                    _delUpdateControl.DynamicInvoke();
                    UpdatePanel1.Update()
                    break;
            }
 
This is the Dynamic Invoke Delegate:
 
public void UpdateStatsControl()
        {
            this.UpdatePanelStats.Update();
            StatsControl.InitializeStatsControl();
 
        }
 
Please tell me a way to refresh and reload the Chart after selecting the required series in the DropDownList.
 
HELP!!!!
Posted 18-Oct-12 17:23pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Marcin Kozub 330
1 OriginalGriff 256
2 Sergey Alexandrovich Kryukov 215
3 Praneet Nadkar 197
4 Richard MacCutchan 182
0 OriginalGriff 8,048
1 Sergey Alexandrovich Kryukov 7,287
2 DamithSL 5,614
3 Manas Bhardwaj 4,986
4 Maciej Los 4,910


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 18 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100