Getting a DAMP mediaitem in umbraco with razor


/ Published in: C#
Save to your folder(s)

This snippet applies if the datatype is DAMP and data is stored as full xml.


Copy this code and paste it in your HTML
  1. @if (Model.media.GetType() == typeof(umbraco.MacroEngines.DynamicXml))
  2. {
  3. //if mediatype is a file
  4. <a href="@Model.media.mediaItem.File.umbracoFile">file</a>
  5. //if mediatype is an image
  6. <img alt="pdf" height="70" src="@Model.media.mediaItem.Image.umbracoFile" />
  7. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.