Register   Login
     
  Latest Posts  
RE: Gallery Upload control not showing
by smcculloch on 3/18/2010 4:31 AM
RSS Character Limitation
by greenflash on 3/18/2010 3:37 AM
RE: BUG So many 404's with rssbutton.gif
by greenflash on 3/18/2010 3:34 AM
RE: NA Latest - Template question
by Declic Video on 3/18/2010 2:16 AM
RE: Where is the NA Latest Article Module setting stored?
by Declic Video on 3/18/2010 2:14 AM
RE: NA Latest - Template question
by Blondie on 3/17/2010 9:03 PM
RE: Multiple images in RSS feed
by eyesocketnet on 3/17/2010 8:20 PM
RE: Images/Lightbox on Listing template
by eyesocketnet on 3/17/2010 8:15 PM
Resouce Files
by IMISOFT on 3/17/2010 5:59 PM
RE: BUG So many 404's with rssbutton.gif
by smcculloch on 3/17/2010 4:30 PM
  Forums  
Subject: UserModuleBase GetSetting Question
Prev Next
You are not authorized to post a reply.

Author Messages
PaulUser is Offline
Gold Membership
Ventrian Newbie
Ventrian Newbie
Posts:1

2/08/2010 8:09 AM  

Hi -

I have a quick module development newbie question that I hope somone can give me insight to. I hope this is an appropriate forum...

I would like to use some custom portal settings but cant seem to call it in code...

if i use:

  Dim setting As Object = UserModuleBase.GetSetting(0, "Security_EmailValidation")
  Label1.Text = CType(setting, String)

My label1 displays: \b[a-zA-Z0-9._%\-+']+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,4}\b

but...

If I add my own setting to the table, PortalSettings (SettingName:My_Test , SettingValue: Hello)

and try call it the same way:

Dim setting As Object = UserModuleBase.GetSetting(0, "My_Test")
Label1.Text = CType(setting, String)

My Label.text shows nothing...

 

Is this even possible?

 

Thanks

Paul MarsdenUser is Offline
Gold Membership
Ventrian Super Newbie
Ventrian Super Newbie
Posts:19


2/08/2010 9:29 AM  

Hi there

 

I'm not sure if this is the best example but this is how I get/set a portal setting for my module.

        private object _data;
        public bool CoreSettingsDefined
        {
            get
            {
                _data = DataCache.GetCache(Constants.CORE_SETTINGS_DEFINED_SETTING);
                if (_data == null)
                {
                    _data = PortalController.GetPortalSetting(Constants.CORE_SETTINGS_DEFINED_SETTING, _portalId, false.ToString());
                    DataCache.SetCache(Constants.CORE_SETTINGS_DEFINED_SETTING, _data);
                }
                return bool.Parse(_data.ToString());
            }
            set
            {
                PortalController.UpdatePortalSetting(_portalId, Constants.CORE_SETTINGS_DEFINED_SETTING, value.ToString());
                DataCache.SetCache(Constants.CORE_SETTINGS_DEFINED_SETTING, value.ToString());
            }
        }

Hope it helps.

 

Paul

Scott McCullochUser is Offline
Administrators
Ventrian Master
Ventrian Master
Posts:17193


2/09/2010 7:00 AM  
Thanks for sharing Paul

Scott McCulloch
Site Administrator
You are not authorized to post a reply.
Forums > General > DotNetNuke Questions > UserModuleBase GetSetting Question



ActiveForums 3.7