Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/461.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript RegisterClientScriptBlock不工作_Javascript_Asp.net_Vb.net - Fatal编程技术网

Javascript RegisterClientScriptBlock不工作

Javascript RegisterClientScriptBlock不工作,javascript,asp.net,vb.net,Javascript,Asp.net,Vb.net,由于某些原因,我的RegisterClient ScriptBlock不存在 我的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 = $(

由于某些原因,我的RegisterClient ScriptBlock不存在

我的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)

有什么想法吗?

您的代码只是定义了一个javascript函数。函数在被调用之前不会执行。请尝试以下方法:

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

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

您的代码只是定义了一个javascript函数。函数在被调用之前不会执行。请尝试以下方法:

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

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


这是什么方法?它的in,Private Sub Update_图表(ByRef表作为数据集)不应该立即执行,它所做的是将这一行放入您的标记中://为什么,我如何执行它?它是什么方法?它的in,Private Sub Update_图表(ByRef表作为数据集)不应该立即执行,它所做的是将这一行放在您的标记中://how come,以及如何执行它?我有,但它在控制台中出错:uncaughtreferenceerror:chart不是defined@mali-在定义图表对象后,必须将其放在何处?在这种情况下,您的问题在于引用javascript图表对象。您可能需要在javascript中将其添加到全局范围,或者使用jQuery来选择元素。如果没有更多的代码,我就无能为力了。在我写这篇文章之前:“var chart=$('#container1')。highcharts();”&(如果你把这两行结合起来,它应该可以工作。您是否收到另一个错误?我收到了,但控制台中出现了一个错误:uncaughtreferenceerror:chart不是defined@mali-在定义图表对象后,必须将其放在何处?在这种情况下,您的问题在于引用javascript图表对象。您可能需要在javascript中将其添加到全局范围,或者使用jQuery来选择元素。如果没有更多的代码,我就无能为力了。在我写这篇文章之前:“var chart=$('#container1')。highcharts();”&(如果你把这两行结合起来,它应该可以工作。你又犯错误了吗?