RegisterClientScriptBlock within AJAX method call

后端 未结 5 1403
长情又很酷
长情又很酷 2020-12-09 12:53

I am trying to RegisterClientScriptBlock in a method that is only called via an AJAX call. It doesn\'t appear to actually register the script on the page and I\'m guessing

5条回答
  •  悲哀的现实
    2020-12-09 13:18

    With AJAX enabled pages, you should use the ScriptManager to register scripts:

    ScriptManager.RegisterClientScriptBlock(Page, typeof(MyPage), 
        "MyScript", "GoStuff()", true)
    

    You can use this to register all your scripts (Original load, postback, AJAX postback).

提交回复
热议问题