0

I have a Chart on a web page. I have few Buttons as well. One of the buttons is to bind data to the chart. And I have a dropdownlist to have different options to load the data and bind the chart.

If I click on other buttons on the page, the page postbacks and the chart become blank. So I googled and added EnableViewState="True" to the Chart. Now I can click on other buttons and on postbacks, the chart is still there. Great.

But when I choose a different item from the dropdownlist and click on the button that do the chart binding, there was an error. I know it is because I set EnableViewState property of the chart to True and there are already data on the chart so the chart won't let me bind data again.

So I tried to set Chart1.ViewStateContent = Nothing on the button click of the button that bind data to the chart. That failed as well. The error is Illegal enum value: 0.

So how to make that work ?

thanks ...

Laurence
  • 7,633
  • 21
  • 78
  • 129
  • Enabling viewsstate do not affect ability to bind control again. It will better if you give text of your exception. – MichaelT Sep 12 '12 at 16:32
  • What chart plugin are you using ?? Also are you binding the chart again when you change the selction.. – Sushanth -- Sep 12 '12 at 16:34
  • Thanks guys .. i might have just solved the problem .. I am binding the chart programmatically so the binding function will create new series on the fly and bind it to the chart again .. Adding this line on the top of the function seems solve the problem .. Chart1.Series.Clear() – Laurence Sep 12 '12 at 16:40

0 Answers0