Dotnetnuke模块通讯问题
我的 dnn 模块通信有问题。我有一个模块,它实现了侦听器和发送器的模块通信接口。在此模块中,我有一个占位符,用于加载新的 ascx 控件。问题是当我想从这个新的动态加载的控件进行通信时。在此控件中,我还实现了模块通信接口(侦听器和发送器)。但是当我调用发送者方法时,在这个动态加载的控件中更新其他模块(在同一页面上)什么也没有发生。但是然后我从动态加载的控件容器控件(我有占位符的控件)调用“发送者”,它可以更新同一页面上的其他模块。这表明模块通信根本无法在动态加载的 ascx 控件中工作。 有没有人有任何想法来解决这个问题 /theonealf
I have a problem with the dnn module communication. I have a module that implements the module communication interface both listener and sender. in this module, I have a placeholder where I load a new ascx control. the problem is when I want to Communicate from this new dynamically loaded control. In this control i also implemented module communication interfaces( listener and sender). but when I call sender method, in this dynamic loaded control to update an other module (on same page)nothing happens. But then i call a " sender " from the dynamic loaded controls container control( the control where i have the placeholder) it works updating the other module on the same page. It seams that module comunications do not work in dynamic loaded ascx controls at all.
Is there anyone who have any idea , to solve this
/theonealf
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我猜这是一个时间问题。尝试在
Init
事件中加载动态控件,并查看它是否会捕获正在发送的通信。I would guess that it's a timing issue. Try loading your dynamic control in the
Init
event, and see if it will catch the communication being sent.同意@bdukes,另外还有一些我建议检查的事情:
可能还有其他检查,但这取决于您通过尝试上述内容和@bdukes 建议得到的答案。
Agree with @bdukes, Also there are additional things that I would recommend to check:
There can be other checks but it depends on your answer by trying above and @bdukes suggestion.
老实说,我在通信接口方面取得的成功有限。如果您能根据自己的需要开始工作,那就太好了。如果您发现需要另一种解决方案,这就是我所做的:
如果我正确理解了问题,那么您关心的是一个模块在加载页面期间需要与另一个模块通信的特定用例。如果是这样,您很可能有一个需要通信的模块,以及一个或多个需要接收该通信的模块。
我将 Context.Items 与 ASP.NET 生命周期结合使用来解决这个问题。
Items
集合只是一个袋子,任何东西都可以塞进去或拉出来。需要通信的模块可以在Page_Load
期间将东西放入该项目包中:需要消耗该东西的模块可以在
PreRender
期间从该包中取出东西。关键是在 PreRender 期间执行此操作。这样,您就可以确保通信的消费发生在通信的产生之后。
祝你好运!
Honestly, I have had limited success with the communications interface. If you can get to work for your needs, then excellent. In case you find you need another solution, here's what I've done:
If I understand the question correctly, you're concerned with the specific use-case where one module needs to communicate with another module during the loading of a page. If that is so, you most likely have one module which is the one that needs to communicate, and one or more modules which need to pick up that communication.
I've used
Context.Items
in combination with the ASP.NET life cycle to solve this problem. TheItems
collection is just a bag that anything can be stuffed into or pulled out of. The module that needs to communicate can put things into that item bag duringPage_Load
:The modules which need to consume that thing can pull things out of that bag during
PreRender
.The key is doing this during PreRender. This way, you are assured that the consuming of the communication happens after the production of the communication.
Good luck!