I have a rad chart which is throwing a java script error on a postback. here is the code:
And here is the code behind:
The first time everything is fine. The chart shows correct data. I also have a button on this page which does a does a postback and some changes to the inputs of the graphs. After the postaback, i am getting a
Microsoft JScript runtime error: Expected ']'
at
{var c=eval(this._dataSource); ( a dynamic page)
and when i see the datasource it is showing as:
[[{"TotalAmount":1000,"campaignID":2,"Name":"Annual Fund"},
{"TotalAmount":300,"campaignID":3,"Name":"Library Fund"}]
{"TotalAmount":1000,"campaignID":2,"Name":"Annual Fund"},
{"TotalAmount":83,"campaignID":1,"Name":"Athletics Fund"},
{"TotalAmount":300,"campaignID":3,"Name":"Library Fund"}]
The first two lines is the data before the postback and the next 3 after the postback. So the problem here is the radchart is not clearing its datatsource. It is also remembering the prrevious one. Can any one please give me a solution ? Thanks.
<
telerik:RadHtmlChart
Width
=
"400px"
ChartTitle-Appearance-TextStyle-FontSize
=
"12px"
Font-Size
=
"12px"
Skin
=
"WebBlue"
ID
=
"chartReportsAll"
runat
=
"server"
Transitions
=
"true"
>
<
PlotArea
>
<
Series
>
<
telerik:ColumnSeries
DataFieldY
=
"TotalAmount"
Name
=
"Test"
></
telerik:ColumnSeries
>
</
Series
>
<
XAxis
DataLabelsField
=
"Name"
Name
=
"test2"
>
<
TitleAppearance
Text
=
"Campaign Name"
>
<
TextStyle
FontSize
=
"12px"
/>
</
TitleAppearance
>
</
XAxis
>
<
YAxis
>
<
TitleAppearance
Text
=
"Amount Donated"
>
<
TextStyle
Margin
=
"20"
FontSize
=
"12px"
/>
</
TitleAppearance
>
</
YAxis
>
</
PlotArea
>
</telerik:RadHtmlChart
And here is the code behind:
chartReportsAll.DataSource = tb2
chartReportsAll.DataBind()
The first time everything is fine. The chart shows correct data. I also have a button on this page which does a does a postback and some changes to the inputs of the graphs. After the postaback, i am getting a
Microsoft JScript runtime error: Expected ']'
at
{var c=eval(this._dataSource); ( a dynamic page)
and when i see the datasource it is showing as:
[[{"TotalAmount":1000,"campaignID":2,"Name":"Annual Fund"},
{"TotalAmount":300,"campaignID":3,"Name":"Library Fund"}]
{"TotalAmount":1000,"campaignID":2,"Name":"Annual Fund"},
{"TotalAmount":83,"campaignID":1,"Name":"Athletics Fund"},
{"TotalAmount":300,"campaignID":3,"Name":"Library Fund"}]
The first two lines is the data before the postback and the next 3 after the postback. So the problem here is the radchart is not clearing its datatsource. It is also remembering the prrevious one. Can any one please give me a solution ? Thanks.