Unable to Get Media Library image URL from Content Only Page Type View Model

Stuart1 Freeman1 asked on December 19, 2019 23:55

Hi All,

I have created a Content Only Page Type with a custom field of type text with form control of media selector. I have generated my custom MenuItem Model code which changed my field name from 'MenuItemIcon' to 'MenuItemIconUrl'.

When I query the a document of this custom type all fields are available but the media selected image url is always empty. Is there some additional trick to retrieving the url? My field type is 'text'. I followed instruction from the Medicio example.

In summary, how do I display a media library image in an MVC view from a content only custom Page Type?

Thanks!

Recent Answers


Juraj Ondrus answered on December 27, 2019 11:37

What code are you using? Are you following this documentation? The media selector field is storing the path to the physical file. So, you can compose the URL from this value on your own as well.

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.