Skip to content

Latest commit

 

History

History
30 lines (24 loc) · 646 Bytes

File metadata and controls

30 lines (24 loc) · 646 Bytes

Legacy Media Picker

Alias: Umbraco.MediaPicker

Returns: IPublishedContent

Typed Example:

    @{
        var typedMediaPickerSingle = Model.Content.GetPropertyValue<IPublishedContent>("multiMediaSingle");
        if (typedMediaPickerSingle != null)
        {
            <p>@typedMediaPickerSingle.Url</p>
        }
    }    

Dynamic Example:

    @{
        if (CurrentPage.HasValue("mainImage"))
        {
            var dynamicMediaPicker = CurrentPage.mainImage;
            <p>Url: @dynamicMediaPicker.Url</p>
            <p>UmbracoFile: @dynamicMediaPicker.umbracoFile</p>
        }
    }