Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
You should be able to do the following:
public override void SetDefaultValues(ContentType contentType)
{
base.SetDefaultValues(contentType);
if (SubMenuLayoutSelector == null)
{
SubMenuLayoutSelector = Resources.MegaSubMenuLayout_OneColumn_Value;
}
}
Hello,
We are using selection factory as shown below:
[Display(
GroupName = SystemTabNames.Settings,
Order = 300)]
[SelectOne(SelectionFactoryType = typeof(MegaSubMenuLayoutSelector))]
[Required]
public virtual string SubMenuLayoutSelector { get; set; }
and setting default value like this:
if (metadata != null)
{
metadata.InitialValue = Resources.MegaSubMenuLayout_OneColumn_Value;
}
But in CMS the field will be blank it's not taking default value set from method.
Is it right way to set the default value for selection factory? We tried this also in model class:
public override void SetDefaultValues(ContentType contentType) { base.SetDefaultValues(contentType); //Set values here }
this method is also not working to set default value.