繁体   English   中英

ScriptManager.RegisterStartupScript

[英]ScriptManager.RegisterStartupScript

在使用scriptManger注册脚本时,在带有更新面板的用户控件中,此代码有效:

ScriptManager.RegisterStartupScript
        (this.updatePanel, this.updatePanel.GetType(), "printing", Keys.URL, true);

但这不起作用

ScriptManager.RegisterStartupScript(this, this.GetType(), "printing", Keys.URL, true);

我不知道为什么?

我认为这是因为在第一个示例中,您正在注册UpdatePanel的脚本(该脚本将在异步回发中进行更新-使脚本得以编写),而在第二个示例中,您是在page级进行操作,因为它不在UpdatePanel范围内,因此不会被更新。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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