May 12, 2008

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")
(updateButton != null

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 forums!

tags: DNN, Tutorials
comments powered by Disqus

Content provided in this blog is provided "AS-IS" and the information should be used at your own discretion.  The thoughts and opinions expressed are the personal thoughts of Mitchel Sellers and do not reflect the opinions of his employer.

Content Copyright

Content in this blog is copyright protected.  Re-publishing on other websites is allowed as long as proper credit and backlink to the article is provided.  Any other re-publishing or distribution of this content is prohibited without written permission from Mitchel Sellers.