I am having a little difficulty in registering the javascript on the client side.
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
JavaScriptSerializer jss = new JavaScriptSerializer();
ClientScript.RegisterStartupScript(this.GetType(), "TestInitPageScript",
string.Format("<script type=\"text/javascript\">google.load('visualization','1.0',{{'packages':['corechart','controls']}});google.setOnLoadCallback(function(){{drawVisualization({0},'{1}','{2}','{3}');}});</script>",
jss.Serialize(GetData()),
"Name Example",
"Name",
"Type Example",
"Type,"));
}
if (!IsPostBack)
{
JavaScriptSerializer jss = new JavaScriptSerializer();
ClientScript.RegisterStartupScript(this.GetType(), "TestInitPageScript",
string.Format("<script type=\"text/javascript\">google.load('visualization','1.0',{{'packages':['corechart','controls']}});google.setOnLoadCallback(function(){{drawVisualization2({0},'{1}','{2}','{3}');}});</script>",
jss.Serialize(GetData2()),
"Name Example",
"Name",
"Type Example",
"Type,"));
}
}
However, only function drawVisualisation is rendering but I cannot get the drawVisualisation2 to render to the client-end.
function drawVisualization(dataValues, chartTitle, columnNames, categoryCaption) {
}
function drawVisualization2(dataValues, chartTitle, columnNames, categoryCaption) {
}
Please advice. Many thanks.