Computer Magic Logo
Check if setting exists

Monday, March 14, 2016

Published by Aristotelis Pitaridis

In order to check if we have stored a specific setting we use the ValueExists static member function of the Settings class. The first parameter is the Application name and the second parameter is the Setting name. The member function returns a boolean value which determines if there is a value stored in the database.

@using CMUmbracoTools.Data
@{ 
    bool ValueExits = Settings.ValueExists("MyApplicationName", "Username");
}