ASP.Net 用户控制 PubSub
有没有办法让一个用户控件引发由另一个用户控件处理的事件,而无需通过页面?我正在使用 Umbraco,并且无权访问页面对象。
--编辑--
Umbraco 有加载到页面中的宏(用户控件)的想法。我无法直接访问该页面,因为这是框架的一部分。
有一个发布订阅 (pubsub) 模式,我知道它可以很好地满足我的需求(2 个需要相互通信的用户控件),但我不确定如何在没有页面对象的情况下将其连接到 ASP.Net 中。
任何帮助将不胜感激。
Is there any way for one user control to raise an event that is handled by another user control without going through the page? I am using Umbraco and do not have access to the page object.
--Edit--
Umbraco has the idea of Macro's (user controls) that it loads into pages. I can't access the page directly as this is part of the framework.
There is a publish subscribe (pubsub) pattern that I know would fit my needs well (2 user controls that need to talk to each other) but am unsure how to hook it up in ASP.Net without the page object.
ANy help would be really appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想这样做,我建议您使用 Webforms MVP,它具有跨演示者消息传递的概念,允许您在一个演示者上发出一条消息,然后由另一个演示者使用。
他们的网站上有一个如何使用它的视频。
I'd recommend that you use Webforms MVP if you want to do that, it has a concept of cross-presenter messaging, allowing you to raise a message on one presenter which is consumed by another.
There's a video of how to use it on their site.