Copied to clipboard

Flag this post as spam?

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


  • Kate 267 posts 610 karma points
    Oct 07, 2013 @ 14:50
    Kate
    0

    how do I get a textstring recursiv in razor

    Hi

    I have a doctype called "Destination" with a property name = destinationName.

    How do I make that recursive in razor?

    I need the text to show on the pages below the page/doctype "Destination"

    Thanks

    /Kate

     

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Oct 07, 2013 @ 15:05
    Dennis Aaen
    0

    Hi Kate,

    I worked on a project in the weekend where I need to make a logo recursive in razor, do it in the same way as I did it.

    @{
        var imageId = Model.AncestorOrSelf().PageLogo;
        var media = Library.MediaById(imageId);
    <img src="@media.umbracoFile" alt="" />
    }

    I your case I think someting like this will work for you.

    @Model.AncestorOrSelf().destinationName

    I hope this will work for you.

    /Dennis

  • Kate 267 posts 610 karma points
    Oct 07, 2013 @ 15:08
    Kate
    0

    Hi Dennis

    I have tried that. But it dit not work

    /Kate

  • Jeavon Leopold 3074 posts 13631 karma points MVP 11x admin c-trib
    Oct 07, 2013 @ 15:30
    Jeavon Leopold
    101

    Hi Kate,

    If you are using a Razor Macro, then @Model._destinationName (see the underscore) will make the property request recursive.

    Full docs here

    If you are using MVC let me know and I'll post a example for you.

    Jeavon

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Oct 07, 2013 @ 16:50
    Dennis Aaen
    0

    Aaarh that is nice Jeavon. Now I also learn something new. I almost learn something new, when I read post about Razor in Umbraco.

    Jeavon I have another issue with some Razor maybe you could help me. I don´t know if it´s okay to link to another issue in here, so I don´t. But only says it can be found under the Razor topic on the Forum.

    /Dennis

     

  • Jeavon Leopold 3074 posts 13631 karma points MVP 11x admin c-trib
    Oct 07, 2013 @ 16:52
    Jeavon Leopold
    0

    Hi Dennis,

    Glad it was useful to you, if you have a new issue best to create as a new topic as others will see it also.

    Jeavon

  • Kate 267 posts 610 karma points
    Oct 07, 2013 @ 20:12
    Kate
    0

    Hi Jeavon

    I totally agree with Dennis. I also learn new stuff everyday :-)

    Thanks for your help


    /Kate

Please Sign in or register to post replies

Write your reply to:

Draft