DNN Text Editor Issues on Module Settings Page 

A while back I received an e-mail from a user of my Expandable Text/HTML module that was reporting errors when trying to save the Header text value, which is input via the settings page of the module using the DNN Text Editor control.  I could not recreate the issue on my DNN 4.5.5 or 4.6.0 installations as it was always saving the records, however for this user no header was ever saved.  He was working with DNN 4.7.0 and could recreate the error on multiple pages.  So I installed a local copy of 4.7.0 and 4.8.2 for testing and was able to recreate the issue.

Regardless of the text input, when saving records with 4.7.0 values from the DNN Text Editor were not saved.  Looking into the issue a bit I found that by default starting in DNN 4.7.0 module settings controls are automatically wrapped in an update panel, which is something that doesn't work for the Text Editor control.  Now the easy solution would be to disable AJAX but that has a big effect on the rest of the site.  I looked around a bit and found the following snippet of code, this code MUST be executed on each page load and ONLY works for settings pages.

if (DotNetNuke.Framework.AJAX.IsInstalled()) 

    
//Get the update button to register as a postback control 
    
System.Web.UI.Control updateButton = this.Parent.TemplateControl.FindControl("cmdUpdate")
  
    if 
(updateButton != null
        DotNetNuke.Framework.AJAX.RegisterPostBackControl(updateButton)

The above code requires that your module be built against DNN 4.6.0 or later as that is the first version that the DotNetNuke.Framework.AJAX items were included.  However this is a simple check to see if AJAX is installed, if it is, it finds the update button from the parent and then registers it as a postback control.  This MUST be done on every page load to ensure that it is always registered as a postback control.

I hope this helps someone out there as it helped me!  A special thanks to the person that first posted this fix to the DotNetNuke.com forums!

Posted by Mitchel on Monday, May 12, 2008
 

Comments

Fantastic resource! Thanks for posting this.

By sirchuy on Friday, June 13, 2008 at 5:43 AM
Click here to post a comment

Donate

Show your appreciation for the content/modules made available by MitchelSellers.com by making a donation. Donations are used to assist with dedicating time to creating free content.