November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
I have figured out what was wrong. I changed the property from a ContentReference to a Url, but had already set a default value using the admin interface. This was then overriding the default set in code. The page model above now works.
I have an image URL as a property for a page, and I would like to set a default value for the property. What is the best way to do this? Here is what I have tried so far:
public class StandardPage : PageData
{
public override void SetDefaultValues(ContentType contentType)
{
base.SetDefaultValues(contentType);
BannerImage = new Url("/Static/img/banner_300.jpg");
}
[UIHint(UIHint.Image)]
public virtual Url BannerImage { get; set; }
...
}
But that renders as src="/Views/Shared/32". which I think is a ContentReference to the same image which was uploaded using the file system. The URL for that item should be "/globalassets/banner-images/banner_300.jpg", which would also work, but how can I create an item of type EPiServer.Url with a local path based on a provided string?