November Happy Hour will be moved to Thursday December 5th.

SelectOne default value

Vote:
 

Hi,

I have a string property marked with the SelectOne property, which displays as a drop down in the editor:

[DefaultValue("00:00")] //not working
[SelectOne(SelectionFactoryType = typeof(TimeSelectionFactory))]
public virtual string TestTime { get; set; }

How can I declare a default value for the drop down?

Many thanks

#175458
Feb 21, 2017 11:13
Vote:
 

I suppose you could use the standard way of setting default values in Episerver, which is to override SetDefaultValues:

public override void SetDefaultValues(ContentType contentType)
{
    base.SetDefaultValues(contentType);
 
    //Set values here
 
}

This will only work on new content though.

#175460
Feb 21, 2017 11:35
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.