Products

Solutions

Resources

Partners

Community

About

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...IMC ProblemIMC Problem
Previous
 
Next
New Post
7/13/2009 10:59 AM
 

Hi,


I have 2 modules on my page; the communication between those 2 modules is working without errors,
The message sent by the Communicator (module2) is received by the listener (module1) successfully.
The code behind of my module2 (the communicator) is :


public partial class DesktopModules_Test_TestUserCon2 : DotNetNuke.Entities.Modules.PortalModuleBase, IModuleCommunicator
{
    public event ModuleCommunicationEventHandler ModuleCommunication;
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }

    protected void Button1_Click(System.Object sender, System.EventArgs e)
    {
        
            ModuleCommunicationEventArgs MCArgs = new ModuleCommunicationEventArgs();
            MCArgs.Sender = "TestCommunication";
            MCArgs.Target = "empty";
            MCArgs.Text =  TextBox1.Text;
            MCArgs.Value = new object();

            if (ModuleCommunication != null)
            {
               ModuleCommunication(this, MCArgs);
            }   
    }
}

The code behind of my module2 (the Listener) is:


public partial class DesktopModules_Test_TestUserCon : DotNetNuke.Entities.Modules.PortalModuleBase,IModuleListener
    
{
     
    protected void Page_Load(object sender, EventArgs e)
    {
      #region IModuleListener Members

       public  void OnModuleCommunication (object s, ModuleCommunicationEventArgs e)
        {
            if (e.Sender == "TestCommunication")
            {
                string imcValue = (string)e.Text;
                TextBox1.Text = imcValue.ToString();
            }
        }
        #endregion
    }

I want to change the text of my TextBox1 in my UserControl - listener (module1) based on the Text sent by the communicator.

Thank You for your help,
Regards,
Elie

 
New Post
7/13/2009 11:53 AM
 

There's nothing that jumps out as wrong with your code.. have you placed breakpoints to ensure that TextBox1.Text has a value when the message is being built? what is happening in the listener? is the message not being received? is the sender not "TestCommunication"? is the e.Text value blank? 

Your code looks ok, but you haven't described what your problem is.

 
New Post
7/13/2009 12:27 PM
 

I would have thought that would work, but I've not used it yet.

I note that most other examples use e.Value not e.Text for the passing of a value. I can't see why you can't use either, but it'd be worth trying. Certainly you don't need to ToString() on the line in red because you've already cast it to string, but it shouldn't break it.

 
New Post
7/13/2009 12:32 PM
 

Oh, hang on. I'm not a C# person, but haven't you put the listener method within the page_load event handler?

Your region for the IModuleListener Members should be outside of the end bracket, not inside it. Maybe it's just the way you pasted it into the page, because if that is really what you have then the page should throw some terrible 'unable to compile' type errors.

 
New Post
7/14/2009 2:53 AM
 
Hi, Thank you for ur reply, first I’m sorry about the code behind of my module2 (the Listener) I have done a mystique while writing my post, the OnModuleCommunication function should be outside the Page_Load .The code should be like this : Public partial class DesktopModules_Test_TestUserCon : DotNetNuke.Entities.Modules.PortalModuleBase,IModuleListener { Protected void Page_Load(object sender, EventArgs e) { } #region IModuleListener Members public void OnModuleCommunication (object s, ModuleCommunicationEventArgs e) { if (e.Sender == "TestCommunication") { string imcValue = (string)e.Text; TextBox1.Text = imcValue.ToString(); } } #endregion } The values are received by the listener and yes while debugging the values of TextBox1.Text is change according to the sent value = that’s mean that the message is received successfully. The Problem is that in the code behind of the listener the value of TextBox1 is changed but visually it isn’t (it’s like the usercontrol is not rendered) I mean on my website the value of TextBox1 never changes.
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...IMC ProblemIMC Problem


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out