If you do not like to read preambula and want to know what is the difference between ModuleSettings and TabModuleSettings, then you can read it here.
Have been worked with it for a long time. Also asked a lot of DotNetNuke gurus, but they did not provide concrete answer about difference between ModuleSettings and TabModuleSettings. In generally it looks the same. For example, we have Settings.ascx. Inside we save some settings, for example Template. So our code should be like this:
Have been worked with it for a long time. Also asked a lot of DotNetNuke gurus, but they did not provide concrete answer about difference between ModuleSettings and TabModuleSettings. In generally it looks the same. For example, we have Settings.ascx. Inside we save some settings, for example Template. So our code should be like this:
ModuleController objModules =
new
ModuleController();
objModules.UpdateModuleSetting(ModuleId,
"template"
, tbSettings.Text);
or you can use
ModuleController objModules =
new
ModuleController();
objModules.UpdateTabModuleSetting(TabModuleId,
"template"
, tbSettings.Text);
Later, when you get template from the Settings in your PortalModuleBase with code like this:
string
Template = (
string
)Settings[
"template"
];
It always returns the same value, nevermind what do you use ModuleSettings or TabModuleSettings. I thought it is true until yesterday. Yesterday i had to write module for one customer who uses "Adding of existing module" to the different pages. This client was happy with module. But asked me to do something with settings. Always he puts link to existing module and needs to setup settings again.
After small research all is clear:
- When you use TabModuleSettings, then these settings work for the single place where is these module. If you ad copy of this module to another page, then TabModuleSettings returns null until you setup it.
- In case you need to use single settings for all modules linked to the existing one, then you should use ModuleSettings instead of TabModuleSettings. Then all of them will use the same settings.
As much i work with DotNetNuke as more i love it :)
What about adding existing module but like a copy, how to make settings be the same for the new module ?
ReplyDeleteYou can add existing module to the page. Just switch at the top "Add existing module", then select page you want to add module from and select module you want to add. And you will copy of the module at another page.
ReplyDeleteIf i drop module in different pages, it is asking different settings but the above they mentioned, module drop in anynumber of pages it is taking same setting in all pages, that is wrong it is taking different settings for different pages.
ReplyDeleteThen what is the different between updatemodulesettings and updatetabsettings.
Please let me know.
sridhar
ReplyDeleteYour question is not clear. Difference described in the article.