ASP.NET中嵌套在更新面板的用户控件的JavaScript注入 [英] ASP.NET inject javascript in user control nested in update panel
问题描述
我想一个asyncron回发更新面板的过程中的javascript code与用户Web控件加载到通过的Page.LoadControl方法的页面。
I'm trying to load javascript code with a user web control into a page via a the Page.LoadControl method during an asyncron post back of an update panel.
我试过的ScriptManager的专门为这种情况设计的方法,但JavaScript的只是好好尝试一下得到返回给用户。
I've tried the specially for that scenario designed methods of the scriptmanager, but the javascript just doens't get returned to the user.
要解释一下我的情况好一点:
To explain my scenario a bit better:
母版页有脚本管理器和一个页面加载一个异步回发期间通过Page.LoadControl法的用户控件。在prerender事件的自定义控件内喷射处理程序的JavaScript。那是个时机问题注入JS或只是不可能这样做?
Master Page has the script manager and one page loads the user control via Page.LoadControl-method during an async post back. The custom control injects in the prerender event handler the javascript. Is that a matter of timing to inject the js or is it just not possible to do so?
希望有一个人有一个想法。
提前堆感谢,
derSteve
Hope some one has an idea for that. Heaps thanks in advance, derSteve
推荐答案
有关,你可以做
string scr;
scr = "<script src='/scripts/myscript.js'></script>"
Page.ClientScript.RegisterStartupScript(GetType(Page), "key", scr, false)
心连心
这篇关于ASP.NET中嵌套在更新面板的用户控件的JavaScript注入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!