Click here to Skip to main content
15,888,454 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a webform on which i created javascript Amcharts using Amready method and bind to the form using divs. i have also an updatepanel inside which divs are placed for which Javascriprt amcharts are created. I have also a button inside updatepanel clicking which will do the partial page postback. The problem is when the page is partially postback the javascript script is not executed which doesnot allow the divs to bind the chart. The charts become invisible. My question is how to make charts bind after the partial page postback.

What I have tried:

I created an update panel and placed the chart divs and a button inside the update panel. In the scriptmanager i added the script reference of AMCharts. I tried to call the function AMready inside update panel using Sys.Application.Initialize() and Sys.Application.add_load(DrawAMchart); but nothing is working. I also tried to call the DrawAMChart() using ScriptManager.RegisterStartupScript() method but could not able to get the chart after partial page postback.
Posted
Updated 12-Apr-16 22:37pm
Comments
F-ES Sitecore 13-Apr-16 4:43am    
These problems are usually because you haven't taken into account that anything inside your update panel is destroyed and re-created so any events etc you have attached pre-postback are gone after and need re-attached. You'll need to post the relevant code for anyone to give specific advice.

http://forums.asp.net/t/1982846.aspx?How+to+run+javascript+after+updatepanel+execution+completed
hinaiqbal 13-Apr-16 5:44am    
I have visited this link earlier and i could not understand how to get the divs id. also although there is a button but page is not posted back. but in my case page is posted back and charts have to bind with the divs

1 solution

Don't use the update panel if possible.Go directly with the jquery.And call the webMethod
 
Share this answer
 
Comments
hinaiqbal 13-Apr-16 5:22am    
update panel is necessary thats why asking... if only the divs for creating charts are placed outside updatepanel its working also on the partial post back but my question is to place divs inside updatepanel and on partial postback reload the Javascript AMcharts

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900