使用 ScriptManager 在 CompositeControl 上添加脚本?
我试图在友好的“ScriptManager”类上调用我的旧“RegisterClientScriptBlock”。
它对我的 CompositeControl 不起作用? 我在正常的用户控件(ascx)上使用它,它可以工作。
Visual Studio 根本不会接受我输入“ScriptManager”,或者如果我输入“ScriptManager”并尝试编译,我会收到“当前上下文中不存在名称“ScriptManager””。 出了什么问题 - 我确实有对 System.Web.UI 的引用,我什至让 resharper 帮助我添加它(和 using 语句) - 如果它只在那里的话。
好吧,一些非常简单的事情,逻辑现在正在下降,我只需要知道什么......
有什么想法吗?
我获得了带有 SP1 的 Visual Studio 2008。
编辑:不起作用的 CompositeControl 实际上是一个简单的类库,而不是 ascx 文件自然是的 Web 应用程序的一部分。 我知道这可能会导致问题,因为我必须以某种方式设置对页面的引用 - 我尝试查看 ClientScriptManager 但它的构造函数是内部的,表明它在 ScriptManager 内部的某个地方使用 - 但它也暗示可能有一个入口来自类库(没有对 Page 对象的编译时引用)
I'm trying to call my good old 'RegisterClientScriptBlock' on the friendly 'ScriptManager' class.
It just doesn't work for my CompositeControl? I use it on a normal usercontrol (ascx) where it works.
Visual Studio simply won't accept me typing 'ScriptManager' or i get "The name 'ScriptManager' does not exist in the current context" if i do and try to compile. What's wrong - i do have references to System.Web.UI and i even got resharper to help me add it (and the using statement) - if it had only been there.
Ok so something very simple and logic is going down now, i just need to know what...
Any ideas?
I got Visual Studio 2008 with SP1.
EDIT: The CompositeControl that doesn't work is actually a simple Class Library and not part of the web application the ascx file naturally is. I know this could cause problems since i would have to set a reference to the Page somehow - i tried looking at ClientScriptManager but it's constructor is internal indicating it's used somewhere like internally from ScriptManager - but it also hints that there might be an entrance comming from a class library (with no compiletime reference to the Page object)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
终于找到了:)
Finally found it :)