Page 1 of 1

unable to change NoClickPostback property after first time

Posted: Sun Mar 27, 2011 8:29 pm
by 15657590
I am using TeeChart for ASP .NET.

By default I am able to disable single clicks on my chart by setting NoClickPostback to true.
I have a callback function(ASP:button) through which I try to set NoClickPostback to false, so that single clicks are enabled again. But they are not getting enabled again.

In short,
If I set NoClickPostback to true in the beginning, I am never able to enable single clicks again. In the same way, If I set NoClickPostback to false in the beginning, I am never able to disable single clicks.


thanks
Jagadish

Re: unable to change NoClickPostback property after first time

Posted: Mon Mar 28, 2011 10:41 am
by 10050769
Hello Jagadish,

Using next code where disable or enable AutoPostBack, when you clicks a button:

Code: Select all

    protected void InitializeChart()
    {
        Steema.TeeChart.Chart ch1;
        tmpChart = new System.IO.MemoryStream();
        if (Session["ch1"] == null)
        {
            ch1 = WebChart1.Chart;
            ch1.Aspect.View3D = false;
            Series1 = new Steema.TeeChart.Styles.Line(ch1);
            Series1.FillSampleValues();
            Button1.Click += new EventHandler(Button1_Click);
            ch1.Export.Template.Save(tmpChart);
            //save template to a Session variable
            Session.Add("ch1", tmpChart);
        }
        else
        {
            //retrieve the session stored Chart
            tmpChart = (System.IO.MemoryStream)Session["ch1"];
            //set the Stream position to 0 as the last read/write
            //will have moved the position to the end of the stream
            tmpChart.Position = 0;
            //import saved Chart
            WebChart1.Chart.Import.Template.Load(tmpChart);
            Button1.Click += new EventHandler(Button1_Click);
        }

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        WebChart1.AutoPostback = !WebChart1.AutoPostback;
        if (WebChart1.AutoPostback)
        {
            WebChart1.Chart.Header.Text = "Hello";
        }
        else
        {
            WebChart1.Chart.Header.Text = "Good bye";
        }
    }
Could you tell us if previous code works as you expected?

Thanks,

Re: unable to change NoClickPostback property after first time

Posted: Tue Mar 29, 2011 5:10 pm
by 15657590
Hi Sandra

Both methods work now. The problem was in the AJAX sript I was using. Thanks for the help.


-Jagadish