Reputation: 73
I have an asp chart
that refreshes whenever I click a button even when the whole form is inside Update panel
. Other controls like text boxes are not refreshing (which is okay) but only the chart that refreshes.
<asp:Button runat="server" id="btnPostback" style="display:none" onclick="Chart1_Click" />
<div class="recent-report__chart" onclick="document.getElementById('<%= btnPostback.ClientID %>').click()">
<asp:Chart ID="Chart1" runat="server" Width="600px" Palette="EarthTones">
<Series>
<asp:Series Name="Series1" />
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1"></asp:ChartArea>
</ChartAreas>
</asp:Chart>
</div>
As it is clear in the code that I am calling the button btnPostback's
click event by clicking on the chart. The moment I click the button it performs it functionality but the chart clears its data.
Upvotes: 1
Views: 172
Reputation: 73
In case any one stumbles upon this question, I solved this by setting EnableViewState
of the asp chart to true
.
Upvotes: 2