jxycms
12/19/2016 - 10:13 PM

customer setting

customer setting

in kentico, Module-->custom setting-->add new group-->add new key
then go to setting-->custom setting-->add value for the key

//get current node in the page tree
TreeNode eventNode = CMSContext.CurrentDocument;
string messageIsBookingEventOpenRegistration = null;
//get value of key "BookingEventOpenRegistration" from custom setting
stringKeyValue = ValidationHelper.GetString(SettingsKeyInfoProvider.GetValue(SiteContext.CurrentSiteName + ".CWA_DevDynamicsCrmUrl"), "");
boolKeyValue = ValidationHelper.GetBoolean(SettingsKeyInfoProvider.GetBoolValue(SiteContext.CurrentSiteName + ".CWA_IsDynamicsCrmLiveMode"), false);
//check whether in the page which is booking event class page type
if (eventNode.NodeClassName.IsSame("CMS.BookingEvent"))
  {
    //get value of property from page type BookingEvent
    if (!String.IsNullOrEmpty(eventNode.GetStringValue("BookingEventOpenRegistrationOverride", "")))
    messageIsBookingEventOpenRegistration = eventNode.GetStringValue("BookingEventOpenRegistrationOverride", "");
  }