I've searched online and found a few examples of how to retrieve a Settings value in another user control, but I can't get it working. I've verified that the value is getting stored in the TabModuleSettings table, and I can get and set the value within the Settings.ascx.cs file by using:
// Set the value in Settings.ascx.cs UpdateSettings
ModuleController modules = new ModuleController();
modules.UpdateTabModuleSetting(TabModuleId, "RequireRenewal", "is this even working?");
// Get the value in Settings.ascx.cs LoadSetttings
string strRequireRenewal = (string)TabModuleSettings["RequireRenewal"];
But if I try to get that value within a nested user control in my View.ascx control, I get a null reference. What am I doing wrong? I've tried:
ModuleController objModuleController = new ModuleController();
var tempValue = objModuleController.GetTabModuleSettings(TabModuleId);
string strRequiredRenewal = tempValue["RequireRenewal"].ToString();
And
string strRequiredRenewal = string.Empty;
if ((string)Settings["RequireRenewal"] != "") // this evaluates to true, but fails when trying to set the value below
strRequiredRenewal = Convert.ToString(this.Settings["RequireRenewal"]);
Is the issue because of the nested User Control? Any help is appreciated