I've gotten it partially working however raising the ModuleCommunication event seems to wipe out postback info so I get NullReferenceExceptions when the page reloads after the click (Object reference not set to instance of object). Specifically, I seem to be losing the module data.
When I click the icon once to fire the modulecommunication event, the page reloads with the skin and container but the module contents are lost and I see the error message above the module title. If I click the button a second time, the skin and contain disappear too and I only see the error message on a blank page.
The error message is this:
DotNetNuke.PageLoadException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object. at PDFExporter.PDFExport.cmdGenerate_Click(Object sender, ImageClickEventArgs e) in c:\localhost\desktopmodules\pdfexporter\pdfexport.ascx.cs:line 197 at System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) at System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Page.ProcessRequestMain() --- End of inner exception stack trace ---
My code is C# and the general setup for the Communicator class is this setup like this (I inherit SkinObject and implement the IModuleCommunicator interface):
public class PDFExport : DotNetNuke.SkinObject, DotNetNuke.IModuleCommunicator
{
//My button
protected System.Web.UI.WebControls.ImageButton pdfImage;
//Implement the interface event
public event ModuleCommunicationEventHandler ModuleCommunication;
//bunch of methods and stuff
//button click handler
private void cmdGenerate_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
ModuleCommunicationEventArgs modEventArgs = new ModuleCommunicationEventArgs();
ModuleCommunication(this, modEventArgs);
}
}
The error that always gets thrown complains about the line line shown: ModuleCommunication(this, modEventArgs). Does anyone have some experience with this so they can shed some light on my problem.