Return to Snippet

Revision: 51423
at September 23, 2011 20:23 by fengelz


Updated Code
@if (Model.media.GetType() == typeof(umbraco.MacroEngines.DynamicXml))
{
   //if mediatype is a file
   <a href="@Model.media.mediaItem.File.umbracoFile">file</a>
   //if mediatype is an image 
   <img alt="pdf" height="70" src="@Model.media.mediaItem.Image.umbracoFile" />
}

Revision: 51422
at September 23, 2011 20:00 by fengelz


Initial Code
@{
    var companyNode = Model.NodeById(Model.company);
    if (companyNode.annualAccounts.GetType() == typeof(umbraco.MacroEngines.DynamicXml))
    {
    <div class="sub-box">
        <a href="@companyNode.annualAccounts.mediaItem.File.umbracoFile">
            <img alt="pdf" height="70" src="/images/pdf-icon.png" />
        </a>
    </div>
    }
}

Initial URL

                                

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

Initial Title
Getting a DAMP mediaitem in umbraco with razor

Initial Tags

                                

Initial Language
C#