本文介绍了时使用的ScriptManager和ClientScript之间的差异来执行JS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

能为我解释人的差异和的ScriptManager之间ClientScript什么?

Can somebody explain for me what the differences are between ScriptManager and ClientScript?

ClientScript效果很好,当我在Button_Clicked事件中使用它,但是当我在GridView的GridView_RowUpdated使用它,它不工作。 (该GirdView是一个更新面板内包裹)。然后我试图ClientScript,它在这种情况下完美。

ClientScript works well when I use it in Button_Clicked event, but it doesn't work when I use it in the GridView_RowUpdated of a GridView. (The GirdView is wrapped inside an update panel). Then I tried ClientScript and it worked perfectly in this case.

推荐答案

您已经pretty多少确定的主要区别。使用ScriptManager意指与异步回发使用,这就是为什么它与在UpdatePanel工作。该ClientScript类是同步回发。所以,如果你要张贴在一个UpdatePanel回来,一定要使用的ScriptManager,而不是ClientScript。

You've pretty much identified the primary difference. The ScriptManager is meant to be used with async postbacks, which is why it works with the UpdatePanel. The ClientScript class is for synchronous postbacks. So, if you're going to be posting back from an UpdatePanel, be sure to use the ScriptManager instead of ClientScript.

ScriptManager

这篇关于时使用的ScriptManager和ClientScript之间的差异来执行JS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 00:57