简体   繁体   中英

RegisterClientScriptBlock not working

my RegisterClientScriptBlock is not exicuting for some reason

my code on 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)

any ideas on why?

Your code is simply defining a javascript function. Functions are not executed until they are called. Try this instead:

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM