private void PopulateCustomSettings() { // these are the Settings attached to the Module Definition DefaultSettings = ModuleSettings.GetDefaultSettings(this.module.ModuleDefId); // these are the settings attached to the module instance ArrayList customSettingValues = ModuleSettings.GetCustomSettingValues(this.module.ModuleId); foreach (CustomModuleSetting s in DefaultSettings) { bool found = false; foreach (CustomModuleSetting v in customSettingValues) { if (v.SettingName == s.SettingName) { found = true; AddSettingControl(v); } } if (!found) { // if a new module setting has been added since the // last version upgrade, the code might reach this // it means a Module Definition Setting was found for which there is not // a Module Setting on this instance of the module, so we need to add the setting ModuleSettings.CreateModuleSetting( module.ModuleGuid, moduleId, s.SettingName, s.SettingValue, s.SettingControlType, s.SettingValidationRegex, s.ControlSrc, s.HelpKey, s.SortOrder); // add control with default settings AddSettingControl(s); } } }