Solved

ASP.NET postback problem

Posted on 2004-03-25
1
425 Views
Last Modified: 2012-06-21
Hi,

I am using the Carlos Web Chart Control on my aspx page, but everytime a postback occurs the Chart(rendered as an image) disappears.

//using this code the Chart disappears in postback
void Page_Load()
{
    if(!Page.IsPostBack)
    {
      CreateChart();
    }
}

//so I'm using this code which works but is unefficient...
void Page_Load()
{
      CreateChart();
}

//maybe this piece of code may also be helpfull in your solution
void CreateChart()
{
    LineChart chart = new  LineChart();
    chart.DataSource = GetDataSet().Tables[0].DefaultView;
    chart.DataXValueField = "Time";
    chart.DataYValueField = "Wavelenght";
    chart.LineMarker.Size = 0;
    chart.Line.Color=System.Drawing.Color.Blue;
    chart.Line.Width=2;
    chart.DataLabels.ForeColor = System.Drawing.Color.Blue;
    chart.DataBind();
    ChartControl1.Charts.Add(chart);
    ChartControl1.RedrawChart();
}



0
Comment
Question by:Raab314159
1 Comment
 
LVL 29

Accepted Solution

by:
David H.H.Lee earned 250 total points
ID: 10676239
Raab314159,
If the created component is created dynamically, you need to re-create the chart for every postback unless you only deal with viewstate problems only. If the used component is static, you only need to make sure EnableViewState=True.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question