Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Høgni 16 posts 66 karma points
    Nov 12, 2013 @ 09:12
    Høgni
    0

    Display image none Razor

    Hi

    I'm very new to umbraco and Razor, so i hope someone can help me.

    I have a document type with a property called "image" which has a type Upload

    What i want to do is when the image property is emtey it will not be displayed on the browser. and when it has a value it will be displayed.

     

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Nov 12, 2013 @ 09:22
    Dennis Aaen
    0

    Hi Høgni and welcome to Our!.

    Something like this should work for you

    @{ 
     
    if(Model.HasValue("image")){
     
    <img src="@Model.Image"/>
     
    }
    }

    Hope this will help you to display your image

    /Dennis

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Nov 12, 2013 @ 09:22
    Jeavon Leopold
    1

    Hi and welcome to Our!

    You find an example of using an upload editor here but you may find that a media picker is more appropriate?

    Jeavon

  • Høgni 16 posts 66 karma points
    Nov 12, 2013 @ 09:36
    Høgni
    0

    Hi guys... I figured it out myself :) but thank you

Please Sign in or register to post replies

Write your reply to:

Draft