用于执行JS时ScriptManager和ClientScript之间的差异?

Xit*_*rum 8 c# asp.net

有人可以解释一下ScriptManager和ClientScript之间的区别吗?

当我在Button_Clicked事件中使用ClientScript时,ClientScript运行良好,但是当我在GridView的GridView_RowUpdated中使用它时,它不起作用.(GirdView包含在更新面板中).然后我尝试了ClientScript,它在这种情况下运行得很好.

She*_*yFM 12

你已经确定了主要的区别.ScriptManager旨在与异步回发一起使用,这就是它与UpdatePanel一起使用的原因.ClientScript类用于同步回发.因此,如果您要从UpdatePanel回发,请务必使用ScriptManager而不是ClientScript.

的ScriptManager