ok, so that was the quick and dirty way to do it. A Response.Redirect will work but the proper way is IMC. Here's how you do that..
You have 2 modules, 1 will be the 'Sender' and 1 will be the 'Listener'
In the 'Sender' module, in the class declaration, implement the IModuleCommunicator interface, and declare a Public event
Public MustInherit Class RepositoryDashboard
Inherits Entities.Modules.PortalModuleBase
Implements Entities.Modules.IActionable
Implements Entities.Modules.IPortable
Implements Entities.Modules.ISearchable
Implements Entities.Modules.Communications.IModuleCommunicator
Public Event ModuleCommunication(ByVal sender As Object, ByVal e As
DotNetNuke.Entities.Modules.Communications.ModuleCommunicationEventArgs) Implements
DotNetNuke.Entities.Modules.Communications.IModuleCommunicator.ModuleCommunication
|
Now in response to an event within the Sender module, such as selecting an item in your treeeview control, you want to send a 'message' to the 'Listener' module.
Dim moduleCommunicationEventArgs As New ModuleCommunicationEventArgs
moduleCommunicationEventArgs.Sender = "MySenderModule"
moduleCommunicationEventArgs.Target = "MyListenerModule"
moduleCommunicationEventArgs.Value = TreeView1.SelectedValue
moduleCommunicationEventArgs.Type = "CategoryChanged"
RaiseEvent ModuleCommunication(Me, moduleCommunicationEventArgs) |
Now, we move to the 'Listener' module. This is the one that will listen for Events
First, the Listener must Implement the IModuleListener interface
Public MustInherit Class MyListenerModule
Inherits Entities.Modules.PortalModuleBase
Implements Entities.Modules.IActionable
Implements Entities.Modules.IPortable
Implements Entities.Modules.ISearchable
Implements Entities.Modules.Communications.IModuleListener |
Then declare a Public Sub that will be executed when a mesage is received
Public Sub OnModuleCommunication(ByVal s As Object, ByVal e As ModuleCommunicationEventArgs) Implements
IModuleListener.OnModuleCommunication
' only handle messages that are sent from my Sender module and only if they are for CategoryChanged
If e.Sender = "MySenderModule" And e.Type = "CategoryChanged" Then
' get the value passed as part of the message
Dim sPath as string = e.Value.ToString()
' do whatever you need to do here...
End If
End Sub
|
Now, when you click on your treeview to select a new catgeory, your Sender module will raise an event. The Listener module will receive the event, verify that it was indeed the Sender that sent the message and that the message is for a category change, then the Listener can look at the Value property of the message to see what the selected category was.
So, now you have 2 ways to solve your problem. You can use response.redirect or inter-process communications. Use whichever one you feel works best for you. I would suggest that if you are sure the 2 modules will be on the same page, use IMC, if not, use Redirect. My Repository module actually performs a check to see if the two modules are on the same page and will use either IMC or redirect as approriate.