Try our conversational search powered by Generative AI!

PropertyAppSettings

Vote:
 

Is there a method in the API where i can get all the values (keys and descriptions) from a PropertyAppSettings property?

right now i'm using something like below, but I think there must be something in the API to get the values

            string types = ConfigurationManager.AppSettings[this.AppsettingsKey];
            if (!String.IsNullOrEmpty(types))
            {
                string[] items = types.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)
                    .Select(t =>
                    {
                        string[] option = t.Split(";".ToCharArray());

                        return String.Format(
                            "<a href=\"{0}?{1}={2}\" title=\"{3}\">{3}</a>",
                            SiteConstants.SearchPage,
                            this.ParamKey,
                            option[1],
                            option[0]);
                    })
                    .ToArray();

                this.rptLinks.DataSource = items;
                this.rptLinks.DataBind();
            }

    

#65811
Feb 11, 2013 12:32
Vote:
 

If you're using PropertyDropDownList instead of PropertyAppSettings, you can get all the options with this code:

var settings = (MultipleOptionsListSettings)page.Property[propertyName].GetSetting(typeof(MultipleOptionsListSettings));

return settings.ListOptions;

    

#65816
Feb 11, 2013 14:03
Vote:
 

Thanks Johan, but i was wondering if there is a method where you don't need an instance of the page. 

#65879
Feb 13, 2013 12:12
Vote:
 

I don't think there is a way to retrieve the settings without poperty data (which you get from the page data), because the settings can be global or in the page definition it self.


Maybe there is a way by loading the page definition, EPiServer.DataAbstraction.PageType.Load("Regular Page").

#65884
Feb 13, 2013 12:56
Vote:
 

I don't think there is a way to retrieve the settings without poperty data (which you get from the page data), because the settings can be global or in the page definition it self.


Maybe there is a way by loading the page definition, EPiServer.DataAbstraction.PageType.Load("Regular Page").

#65885
Feb 13, 2013 12:56
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.