0

I have a function in JavaScript from this Google Chart

function drawVisualization() {
  // Create and populate the data table.
  var data = google.visualization.arrayToDataTable([
    ['Name',                                                                 'Manager', 'Tooltip'],
    ['Mike',                                                                 null,      'The President'],
    [{v: 'Jim', f: 'Jim<br/><font color="red"><i>Vice President<i></font>'}, 'Mike',    null],
    ['Alice',                                                                'Mike',    'wonderland'],
    ['Bob',                                                                  'Jim',     'Bob Sponge'],
    ['Carol',                                                                'Bob',     null]
  ]);

  // Create and draw the visualization.
  new google.visualization.OrgChart(document.getElementById('visualization')).
      draw(data, {allowHtml: true});
}

I don't understand how I can fill the data array variable, which is declared in JavaScript.

3

1 Answer 1

0

You need to do something like following.

  string serverVariable = "abc";
        string script = string.Format("javascript:var j={0};", serverVariable);        
        ScriptManager.RegisterStartupScript(this, this.GetType(), "uniqueKey", script, true);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.