Usman ur Rehman Ahmed's blog

Toggle Partial Rendering for Module Controls in DNN

In DNN version 6.0 by default the module controls supports partial rendering/AJAX. Depending upon your needs (force download file for example) you can toggle this functionality as following,

Step 1

Go to Host > Extensions > Edit your module by clicking on the little pencil icon.

Step 2

Edit the desired module control for which you want to enable/disable "partial rendering" 

Module_controls
Step 3

Check/Uncheck "Supports partial rendering?" and press Update.

Supports_partial_rendering

Various levels of control for custom module settings

From the DNN's intrinsic html Module settings you will find the ability to apply workflow at various levels of site ranging from module instance to site level. Often this requirement triggers for custom modules in a generic way.

Module_settings
Below please find custom code written to perform this task such that any key/value pair can be stored for any given module refererred by module friendly name.

1- Site Level

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// This method adds the key if not present and if present, updates its value.
        /// Per Site or portal level: meaning all modules instances of type specified by ModuleFriendlyName placed on entire portal will be affected
        /// </summary>
        /// -----------------------------------------------------------------------------      
        public static bool UpdateModuleSettingPerSite(string ModuleFriendlyName, string key, string value, int portalId)
        {
            try
            {
                ModuleController mc = new ModuleController();
                ArrayList existMods = mc.GetModulesByDefinition(portalId, ModuleFriendlyName);

                foreach (DotNetNuke.Entities.Modules.ModuleInfo mi in existMods)
                {
                    if (!mi.IsDeleted)
                    {
                        mc.UpdateTabModuleSetting(mi.TabModuleID, key, value);
                    }
                }

                return true;
            }
            catch
            {
                throw;
            }
        }


2- Page Level

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// This method adds the key if not present and if present, updates its value.
        /// Per Page level: meaning all modules instances of type specified by ModuleFriendlyName placed on this particular page will be affected
        /// </summary>
        /// -----------------------------------------------------------------------------      

        public static bool UpdateModuleSettingPerPage(string ModuleFriendlyName, string key, string value, int tabId, int portalId)
        {
            try
            {
                ModuleController mc = new ModuleController();

                ArrayList existMods = mc.GetModulesByDefinition(portalId, ModuleFriendlyName);

                foreach (DotNetNuke.Entities.Modules.ModuleInfo mi in existMods)
                {
                    if (!mi.IsDeleted && mi.TabID == tabId)
                    {
                        mc.UpdateTabModuleSetting(mi.TabModuleId, key, value);
                    }
                }
                return true;
            }
            catch
            {
                throw;
            }
        }


3- Module Level

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// This method adds the key if not present and if present, updates its value.
        /// Per Module level refers to current module instance, from where settings action was clicked.
        /// </summary>
        /// -----------------------------------------------------------------------------      

        public static bool UpdateModuleSettingPerModule(string ModuleFriendlyName, string key, string value, int TabModuleId)
        {
            try
            {
                //Verified that UpdateModuleSettings() updates the precise module instance only and not the settings common to all instances of that type
                ModuleController objModules = new ModuleController();
                objModules.UpdateTabModuleSetting(TabModuleId, key, value);
                return true;
            }
            catch
            {
                throw;
            }
        }

Filed under: API DNN Dot Net Nuke Module
11
To Posterous, Love Metalab