Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8928095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:21:36+00:00 2026-06-15T08:21:36+00:00

In Javascript I’m calling a function that retrieves data from a data table and

  • 0

In Javascript I’m calling a function that retrieves data from a data table and converts it to javascriptSerializer, I then use the data in a Javascript chart. Everything works fine the first time round, as soon I change the Dataset selection parameters i.e dates etc, and call Function PopulateChart() again to try to pull a new set of data, I have a problem retrieving it in the javascript. The data and json string is populated correctly on the server but not on the client, the old string of data still exists.

var chartData still shows the old Data, even through the returned serializer.Serialize(rows) shows the correct data on the server

Below is my code and what I’m trying to achieve.

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

                    drChart = dtChart.Rows(0)
                    hChartName.Value = drChart.Description

                    HInterval.Value = drChart.Interval
                    Dim dtData As DataTable
                    Dim ds As New DataSet()
                    ds = GetData(4, DateTime.Parse("2012-05-01"), DateTime.Parse("2012-06-30"))
                    dtData = ds.Tables(0)

                    Dim serializer As System.Web.Script.Serialization.JavaScriptSerializer = New System.Web.Script.Serialization.JavaScriptSerializer()
                    Dim rows As New List(Of Dictionary(Of String, Object))

                    Dim row As Dictionary(Of String, Object)

                    For Each dr As DataRow In dtData.Rows
                        row = New Dictionary(Of String, Object)
                        For Each col As DataColumn In dtData.Columns
                            If col.ColumnName = "DateAndTime" Then
                                Dim dts As DateTime = DateTime.Parse(dr(col).ToString())
                                row.Add(col.ColumnName, dts.ToString("yyyy-MM-dd hh:mm:ss"))
                            ElseIf col.ColumnName = "Time" Then
                                Dim ts As DateTime = DateTime.Parse(dr(col).ToString())
                                row.Add(col.ColumnName, ts.ToString("hh:mm:ss"))
                            Else
                                row.Add(col.ColumnName, dr(col))
                            End If
                        Next
                        rows.Add(row)
                    Next

                    serializer.MaxJsonLength = Int32.MaxValue


                    Return serializer.Serialize(rows)
                End If

            End Function
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:21:37+00:00Added an answer on June 15, 2026 at 8:21 am

    var chartData = <%= PopulateChart() %>; will only get evaluated server side at each page load, the <%=....%> is an asp.net wrapper for rendering content in a webpage when and only at a page request. it will not make the PopulateChart() function available to JavaScript on the client side.

    you will need to load new data either by ajax calls or reloading the entire page with request parameters indicating what data is to be loaded.

    Here is an article on codeproject about asp.net and ajax using jquery.

    http://www.codeproject.com/Articles/17203/Using-jQuery-for-AJAX-in-ASP-NET

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Javascript newbie question I'm fetching user input from text and use that value to
JavaScript has lexical scoping which means that non-local variables accessed from within a function
JavaScript/JQuery var arr=[]; $('.element').each(function(i) { arr.push({id:i,value:$(this).attr('data-value')}); }); $.get('/json.php?arr='+arr,function(result) { alert(result); }); PHP <?php $j
JavaScript: $('.addTable').live('click', function () { var appendTxt = <table id='tab1'> <tr><td><input type='text' name='input1' /></td><td><input
javascript snippet : <script type=text/javascript> $(document).ready(function() { setInterval(function() { $.getJSON('notif.php', function(data) { my_var =
JavaScript $.ajax({ type : 'POST', url : 'post.php', data: dataString, success:function (data) { if
javascript code: $.getJSON(comprueba_login.php, {usuario:$(#usuario).val(), pwd:$(#contrasena).val()}, function(data){ alert(resultado: + data.resultado); }); php code: <?php include
Javascript's MATH object has a random method that returns from the set [0,1) 0
JavaScript's getElementById is ok to use, I know that. But how about getElementsByClassName ?
javascript code: function getCheckbox(name,id){ var check = 0; var deger = option-checkbox-+id; var dom

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.