When working with JavaScript, I encountered an issue where the data retrieved from a data table and converted to javascriptSerializer was not refreshing correctly when changing dataset selection parameters. The problem occurred when trying to populate a new set of data using the PopulateChart() function again.
Despite receiving the correct data on the server side and generating the appropriate JSON string, the old data persisted in the client-side var chartData.
Below is the code snippet showcasing the issue:
ASPX
var chartData = <%= PopulateChart() %>;
VB
Public Function PopulateChart() As String
''Get Chart Data
Dim daChart As New dsSVTableAdapters.clsChart
Dim dtChart As New dsSV.webV1_ChartsDataTable
Dim drChart As dsSV.webV1_ChartsRow
dtChart = daChart.GetChart(hChartID.Value)
If dtChart.Rows.Count > 0 Then
'Code for populating chart data goes here'
serializer.MaxJsonLength = Int32.MaxValue
Return serializer.Serialize(rows)
End If
End Function