Hi,
I'm trying to understand why my chart is downloaded empty if I put the "drawing" code in a button event vs. putting it in the page load event. See attached example.
If the chart code is in the page-load event and I click the download button the chart with the data series is downloaded.
If the chart code is in the button-click event and I click the download button the chart without the data series is downloaded.
Thank you.
Understanding Drawing and Download As Image
-
- Newbie
- Posts: 7
- Joined: Mon Mar 20, 2023 12:00 am
Understanding Drawing and Download As Image
- Attachments
-
- WebApplication1.zip
- (8.25 KiB) Downloaded 608 times
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Understanding Drawing and Download As Image
Key points to remember.
An extra point to note, when a button is actuated a page_load occurs followed by the button call method. The session is fluid between them and the chart thus shows six bars if both the page_load and the Buttonxx_Click contain a call to DrawChart.
-------
Possible solutions to carry state:
Use either:
Viewstate to carry data across calls.
See: https://www.c-sharpcorner.com/UploadFil ... Asp-Net53/
Or session; see example here:
https://github.com/Steema/TeeChart-NET- ... rt.aspx.cs
(here used to track a chart zoom to permit incremental zooms)
https://www.steema.net/TeeChartForNET/I ... Chart.aspx
- The Webform app is stateless and has no session memory although it is possible to ‘carry’ session memory by using “sessions” or via ViewState… (comments below).
- Page_load is always called, but not the button code (only called when pressed) … so for every call first an empty page is loaded then page_load is called and then any button code is called
An extra point to note, when a button is actuated a page_load occurs followed by the button call method. The session is fluid between them and the chart thus shows six bars if both the page_load and the Buttonxx_Click contain a call to DrawChart.
-------
Possible solutions to carry state:
Use either:
Viewstate to carry data across calls.
See: https://www.c-sharpcorner.com/UploadFil ... Asp-Net53/
Or session; see example here:
https://github.com/Steema/TeeChart-NET- ... rt.aspx.cs
(here used to track a chart zoom to permit incremental zooms)
https://www.steema.net/TeeChartForNET/I ... Chart.aspx
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 7
- Joined: Mon Mar 20, 2023 12:00 am
Re: Understanding Drawing and Download As Image
Thanks for the refresher.
Got it to work, thank you.
Got it to work, thank you.