Copied to clipboard

Flag this post as spam?

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


  • yumin 51 posts 243 karma points
    Jan 08, 2014 @ 10:45
    yumin
    0

    The @Library class not available in v7

    I has a partial views like this:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    
    <li>@Library.NodeById(1021).Name</li>    
    

    it will get a error:

    Compiler Error Message: CS0103: The name 'Library' does not exist in the current context

    how can i use @Library in v7?

    thanks very much

  • Jeroen Breuer 4909 posts 12266 karma points MVP 5x admin c-trib
    Jan 08, 2014 @ 12:03
    Jeroen Breuer
    101

    Hello,

    @Library is part of the old Razor code and should not be used anymore. See more info here: http://our.umbraco.org/forum/developers/razor/44664-Confused-over-when-DynamicNodeList-is-returned?p=0#comment160691

    Instead try @Umbraco which is a helper which can do the same. More info here: http://umbraco.com/follow-us/blog-archive/2012/10/30/getting-started-with-mvc-in-umbraco-410.aspx

     

    Somethings like this should work:

    <li>@Umbraco.TypedContent(1021).Name</li>  

    Jeroen

  • yumin 51 posts 243 karma points
    Jan 09, 2014 @ 06:48
    yumin
    0

    thanks very much

  • 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