Copied to clipboard

Flag this post as spam?

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


  • Topic author was deleted

    Mar 09, 2011 @ 16:49

    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 5060 posts 15522 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 5060 posts 15522 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
  • Comment author was deleted

    Mar 09, 2011 @ 17:18

    Ok issue logged in codeplex

Please Sign in or register to post replies

Write your reply to:

Draft