Sep
7
Written by:
Larry Daniele
9/7/2008 5:50 PM
On DNNStuff.com site, there's a great article (with source code) IMC Example (DotNetNuke Intermodule Communication) that demonstrates how to implement IModuleCommunicator and IModuleListener interfaces in DNN using two simple modules, one that sends text and one that receives it. It is great to have simple, working code to explain a concept like this. (Note: You'll have to register (for free) on the DNNStuff.com site before you can view the article.)
I would like to offer one suggestion for an improvement…
IMC works great unless you check "Supports Partial Rendering" (i.e. AJAX) for the sender and receiver controls. This is desirable to have one module update the other without the entire page refreshing.
A few simple changes to Receiver.ascx.vb (steps 1-3) and ImcExample.dnn (step 4) will enable AJAX rendering to work:
- Add a reference to System.Web.Extensions to the project.
- Add the line:
Imports System.Web.UI
near the top of the file.
- Add the lines:
' The IMC listener's parent UpdatePanel needs to be set to UpdatePanelUpdateMode.Always()
' (not the default UpdatePanelUpdateMode.Conditional() as is the DNN default) for the
' "Supports Partial Rendering" (AJAX) DNN option to work.
' The IMC sender can use the default setting and does not need this change.
If TypeOf Me.Parent.Parent Is UpdatePanel Then
CType(Me.Parent.Parent, UpdatePanel).UpdateMode = UpdatePanelUpdateMode.Always
End If
to the Page_Load() method.
- Add the line:
true
to each in the .dnn file to enable partial rendering on installation.
Tags: