/// <summary> /// Initialises the instance from the Umbraco prevalue ID /// </summary> /// <param name="dbValue">the Umbraco prevalue ID</param> public void Initialise(int dbValue) { var pval = PreValues.FirstOrDefault(x => x.Id == dbValue); if (pval == null) { base.Initialise(string.Empty); } else { base.Initialise(pval.Value); } }
/// <summary> /// Returns the Umbraco PreValue ID of the selected item, or -1 if an invalid selection is made /// </summary> /// <returns>the Umbraco prevalue ID</returns> public int Serialise() { if (SelectedIndex == -1) { return(0); } var preVal = PreValues.FirstOrDefault(x => x.Value == Options[SelectedIndex]); if (preVal == null) { return(0); } else { return(preVal.Id); } }