RegisterClientScriptBlock无效

时间:2013-07-09 14:32:48

标签: javascript asp.net vb.net

我的RegisterClientScriptBlock由于某种原因没有进行删除

我在vb.net上的代码

Private Sub Update_Chart(ByRef Table As DataSet) 

 (more code but not needed, such as arrays)


  Dim script As String
    script = _
    "function chart()" & _
    "{" & _
   "var chart = $('#container1').highcharts();" & _
    "chart.redraw();" & _
    " }" & _
        ";"


    ScriptManager.RegisterClientScriptBlock( _
        Me, _
        GetType(Page), _
        "container1", _
        script, _
        True)

关于为什么的任何想法?

1 个答案:

答案 0 :(得分:1)

您的代码只是定义了一个javascript函数。在调用函数之前不会执行函数。试试这个:

Dim script As String
script = "chart.redraw();"

ScriptManager.RegisterClientScriptBlock( _
    Me, _
    GetType(Page), _
    "container1", _
    script, _
    True)