Copied to clipboard

Flag this post as spam?

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


  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Mar 09, 2011 @ 16:49
    Tim Geyssens
    1

    Getting Media Name

    Must be missing something obvious here, I can get the umbracoFile fine following the details in

    http://umbraco.com/follow-us/blog-archive/2011/2/24/umbraco-47-razor-feature-walkthrough-%E2%80%93-part-2

    But can't seem to get to the name

    <umbraco:Macro runat="server" language="cshtml">
      @{
        dynamic media = Model.Media("image");
      }
        @media.umbracoFile 
        
      @* doesn't work
      
      @media.Name
      
      *@
      
      
    </umbraco:Macro>

    Any tips on how to get the name?

  • Sebastiaan Janssen 4899 posts 14655 karma points MVP admin hq
    Mar 09, 2011 @ 17:06
    Sebastiaan Janssen
    0

    Hmm, it doesn't work for me either, neither does NodeName or Text. This seems like an oversight, even the sample code for getting a node by Id fails to produce a name:

    @Model.NodeById(Model.Image).Name
    
  • Sebastiaan Janssen 4899 posts 14655 karma points MVP admin hq
    Mar 09, 2011 @ 17:08
    Sebastiaan Janssen
    1

    Of course you could still do it like this:

    @using umbraco.cms.businesslogic.media;
    
    @{
        var media = new Media(Model.Image);
    }
    
    @media.Text
  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Mar 09, 2011 @ 17:18
    Tim Geyssens
    0

    Ok issue logged in codeplex

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies