1

由于某种原因,我的 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)

关于为什么的任何想法?

4

1 回答 1

1

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

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

ScriptManager.RegisterClientScriptBlock( _
    Me, _
    GetType(Page), _
    "container1", _
    script, _
    True)
于 2013-07-09T14:45:03.970 回答