unable to change NoClickPostback property after first time

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
jagadish
Newbie
Newbie
Posts: 9
Joined: Fri Oct 22, 2010 12:00 am

unable to change NoClickPostback property after first time

Post by jagadish » Sun Mar 27, 2011 8:29 pm

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

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: unable to change NoClickPostback property after first time

Post by Sandra » Mon Mar 28, 2011 10:41 am

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,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

jagadish
Newbie
Newbie
Posts: 9
Joined: Fri Oct 22, 2010 12:00 am

Re: unable to change NoClickPostback property after first time

Post by jagadish » Tue Mar 29, 2011 5:10 pm

Hi Sandra

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


-Jagadish

Post Reply