.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> C# >> Post New Resource Bookmark and Share   

 Subscribe to Articles

MSChart state management

Posted By:Suthish Nair       Posted Date: August 29, 2010    Points: 25    Category: C#    URL: http://www.dotnetspark.com  

MSChart have a problem of maintaining data state during post back. When a post back happens the Chart will get blank or data get cleared. Typically charts are used to provide a presentation of data in graphical manner. How can we make the chart object persist its data during post back? There are couple of ways:
 

MSChart state management

 

MSChart have a problem of maintaining data state during post back. When a post back happens the Chart will get blank or data get cleared. Typically charts are used to provide a presentation of data in graphical manner. How can we make the chart object persist its data during post back? There are couple of ways:

  1.  By using the chart ViewState, but ViewState have its own problems.

      Before enabling ViewState


    After enabling ViewState

              <asp:Chart ID="Chart1" runat="server" EnableViewState="true">

 

      

       

       

You can see the difference in bytes size.

2.            By again re-populate the chart with data from database. On every post back we need to use this.

3.             Or save the dataset/datatable and later use for rebinding.

4.             Another efficient way is by saving the Chart into a file. It can be binary or xml.

         By using Charting SerializationFormat, refer msdn URL for more information.

          http://msdn.microsoft.com/en-us/library/system.web.ui.datavisualization.charting.serializationformat.aspx

           Sample code attached, Please post your responses.

 

 


 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend