?
Solved

ASP.NET postback problem

Posted on 2004-03-25
1
Medium Priority
?
440 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 29

Accepted Solution

by:
David H.H.Lee earned 1000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
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/…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

770 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