AI OnAI Off
Not sure if I'm giving you the best help, but mostly decompiling the obsolete method gives you a hint on what you're supposed to do:
var settingsType = typeof(CategorySettings); var propertySettingsRepository = ServiceLocator.Current.GetInstance<IPropertySettingsRepository>(); PropertySettingsWrapper propertySettingsWrapper = null; var settingsContainer = PropertyData.SettingsContainer; if (settingsContainer != null) propertySettingsWrapper = settingsContainer.GetSetting(settingsType); if (propertySettingsWrapper == null) propertySettingsWrapper = propertySettingsRepository.GetDefault(settingsType); if (propertySettingsWrapper != null) { var categorySettings = propertySettingsWrapper.PropertySettings as CategorySettings; }
I am trying to use the code for a multi-select drop down list.
public class PropertyDropdownCheckListControl : PropertyTextBoxControlBase
{
protected System.Web.UI.WebControls.ListBox listBox;
public override bool SupportsOnPageEdit
{
get { return false; }
}
public PropertyDropdownCheckList CategoryCheckBoxList
{
get { return PropertyData as PropertyDropdownCheckList; }
}
public override void CreateEditControls()
{
this.listBox = new ListBox();
listBox.SelectionMode = ListSelectionMode.Multiple;
listBox.ID = "DropdownCheckList";
CategorySettings settings = (CategorySettings)base.PropertyData.GetSetting(typeof(CategorySettings));
But receiving the warning given below for the last line in the code
Warning:
Episerver.Core.PropertyData.GetSetting(System.Type) is obsolete. This method does not support types property settings. Use extension method myContent.GetPropertySettings (p=>p.MainBody) or PropertySettingsResolver to resolve property settings.
can anyone help in this regard..