2013-07-11 49 views
0

您好我有从这个google chart如何填写从服务器端asp.net javascript变量

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}); 
} 

我不在使用JavasScript函数了解我将填充数据数组变量,它被声明在JavaScript

+0

对这一问题的回答[我如何给从ASP.NET变量的JavaScript变量的数据?(http://stackoverflow.com/questions/553813/how-do-i-give-javascript-variables -data-from-asp-net-variables),[从ASP.net传递变量到JavaScript](http://stackoverflow.com/questions/10540217/passing-variable-from-asp-net-to-javascript)和[在asp.net后面的代码中创建javaScript变量](http://stackoverflow.com/questions/4398338/create-javascript-variable-in-code-behind-of-asp-net)例如。请显示你的尝试。 – CodeCaster

+0

它不是一个简单的变量它的数组可以解释更多 – skhurams

+1

我找到一个控件http://googlechartnet.codeplex.com/wikipage?title=Samples&referringTitle=Home谢谢反正 – skhurams

回答

0

你需要做下面的事情。

string serverVariable = "abc"; 
     string script = string.Format("javascript:var j={0};", serverVariable);   
     ScriptManager.RegisterStartupScript(this, this.GetType(), "uniqueKey", script, true); 
相关问题