Computer Magic Logo
Read all the application values

Monday, March 14, 2016

Published by Aristotelis Pitaridis

There are cases that we want to get all the settings for a specific application. In order to read all the values for an application we use the GetValuesByApplication static member function of the Settings class. The parameter of the function is the Application name and the function returns a list of type Setting.

@using CMUmbracoTools.Data
@using CMUmbracoTools.Models
@{ 
    List<Setting> MySettings = Settings.GetValuesByApplication("MyApplicationName");
}
 
<ul>
    @foreach (var item in MySettings)
    {
        <li>@item.Name : @item.Value</li>
    }
</ul>