after the postback the chart control's values is changing its design time values. even when i write page load actions in (!isPostBack) scope , the values resets. so i defined a "my series" static ArrayList and in runtime i added each series of chart to that ArrayList. And in the page load event i added each element of ArrayList to Chart with Chart1.Series.Add(myseries[i] as Series) method. But it failed. "object reference not set to an instance of an object" error occured. Here is my code. Where am i wrong?
public partial class _Default : System.Web.UI.Page
{
static ArrayList my_series = new ArrayList();
void Fill_Chart();
{
....
foreach (Series item in Chart1.Series)
{
my_series.Add(item);
}
}
protected void Page_Load(object sender, EvetnArgs e)
{
...
Chart1.Series.Clear();
for (int i=0;i < my_series.Count;i++)
{
Chart1.Series.Add(my_series[i] as Series)
}
}
i checked this steps with debug. the error didnt occur after passing the line with F10. But when i passed last } symbol in page load event this error occurs.Any idea?