Stellen Sie eine FrageStellen Sie eine Frage
 

BeantwortetRetain Chart On PostBack

  • Donnerstag, 2. Juli 2009 09:36Ohil TeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillen
     Enthält Code
    This question may be a fairly common one, but I don't seem to be able to find a solution.

    I have a simple chart that I am populating in code based on the user who is viewing the website. My problem is that the Chart becomes blank after a post-back on the page. Assuming that I was initializing some data in the asp code, I shifted all my initializations (visual appearance etc) to C# code.

    My aspx page contains just
    <asp:Chart ID="ChartUserPoints" runat="server" Height="247px" Width="382px" style="margin-right: 0px"></asp:Chart>
    

    I have ViewState set to Default. But on each postback, my viewstate data is null. I am using temp file configuration in web.config with timeout = 20 (if that matters)

    Could someone please help me solve this problem?

    • BearbeitetOhil Donnerstag, 2. Juli 2009 09:41
    • BearbeitetOhil Donnerstag, 2. Juli 2009 09:38
    • BearbeitetOhil Donnerstag, 2. Juli 2009 09:38added code, spelling error :P
    •  

Antworten

  • Dienstag, 7. Juli 2009 16:53DelianTMSFT, ModeratorTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillen
     BeantwortetEnthält Code
    Enable view state in the aspx page - EnableViewState have to be set before page load stage:

    <asp:Chart ID="ChartUserPoints" runat="server" Height="247px" Width="382px" style="margin-right: 0px" EnableViewState="True"></asp:Chart>


Alle Antworten

  • Dienstag, 7. Juli 2009 16:53DelianTMSFT, ModeratorTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillenTeilnehmermedaillen
     BeantwortetEnthält Code
    Enable view state in the aspx page - EnableViewState have to be set before page load stage:

    <asp:Chart ID="ChartUserPoints" runat="server" Height="247px" Width="382px" style="margin-right: 0px" EnableViewState="True"></asp:Chart>