live wid knowledge :)

Dotnetnuke Inter Module Communication

Simple as i could make that seamlessly tough concept about dotnetnuke.

i simply made two dotnetnuke modules 1 to send message to other module (receiver). simply implement two dotnetnuke

ready made interfaces and sender raise event and send data in object through eventarguments and receiver get that data through

that raised event.

i think enough talks lets code sorry for stupid formatting :P

Sender Steps with example code:

implement class by IModuleCommunicator like below{

Implements Entities.Modules.Communications.IModuleCommunicator}

Create controls and Add like below{

Me.txtMsg1.Text = “Message 2 Send”
Me.btnSend1.Text = “Send”
Me.Controls.Add(txtMsg1)
Me.Controls.Add(btnSend1)}

Declare Event and make created controls eventable{

Public Event ModuleCommunication(ByVal sender As Object, ByVal e As DotNetNuke.Entities.Modules.Communications.ModuleCommunicationEventArgs)

Implements DotNetNuke.Entities.Modules.Communications.IModuleCommunicator.ModuleCommunication
Protected WithEvents txtMsg1 As New System.Web.UI.WebControls.TextBox
Protected WithEvents btnSend1 As New System.Web.UI.WebControls.Button

}

Declare event arguments and raise event like below in btnSend click event{

Dim objEventArgs As New DotNetNuke.Entities.Modules.Communications.

ModuleCommunicationEventArgs(”IMCSender”, Me.txtMsg1.Text,

GetType(ViewIMCSender).Name, “ViewIMCSReceiver”) RaiseEvent ModuleCommunication(Me, objEventArgs)}

Receiver Steps with example code:

Implement class by IModuleListener like below{

Implements DotNetNuke.Entities.Modules.Communications.IModuleListener}

Implement OnModuleCommunication like below{

Select Case e.Type
Case “IMCSender”
If e.Sender = “ViewIMCSender” And e.Target = GetType(YourCompany.Modules.IMCSReceiver.ViewIMCSReceiver).Name Then
lblReceive.Text = e.Value.ToString()
End If End Select }

 

Comments

Drakiula said:

Making the source code project/solution available might be a good idea.

# January 24, 2008 4:39 AM

Odawg said:

YES

# September 17, 2008 9:52 AM

sangam100 said:

Thanks for the sharing. Code is in vb.net. But no problem, we could easily translate it into C# one.

# April 21, 2009 1:16 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)