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
    Feb 05, 2014 @ 12:25
    Kate
    0

    from xslt to razor - umbraco.library:Replace

    Hi

    I just need to chance this line into razor

    <xsl:value-of select="umbraco.library:Replace($currentPage/ancestor-or-self::*/./phone, ' ', '')"/>

    Thanks in advance :-)

    /Kate

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Feb 05, 2014 @ 17:56
    Jeavon Leopold
    1

    Hi Kate,

    If you are using MVC, then I think this is equivalent

    @{
        var phone = Model.Content.AncestorOrSelf(1).GetPropertyValue<string>("phone").Replace(" ", "");
    }
    <p>@phone</p>
    

    If you are using a Razor Macro (DynamicNode) let me know.

    Jeavon

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Feb 05, 2014 @ 18:49
    Dennis Aaen
    100

    Hi Kate,

    If I understand right what you´re trying to do is remove spaces in a phone number. So if the phone number is 12 34 56 78 you will like to print it like 12345678

    I think Jeavon suggestion is good if you´re using MVC as he said. But if you´re using Razor Macro (DynamicNode)

    @{
        var phone = Model.AncestorOrSelf(1).Phone.Replace(" ", "");
    }
    <p>@phone</p>

    /Dennis

  • Kate 267 posts 610 karma points
    Feb 06, 2014 @ 10:25
    Kate
    0

    Hi

    thanks for your reply.
    I use Razor Macro and Dennis,
    your solution works perfectly

    Thanks again

    /Kate

Please Sign in or register to post replies

Write your reply to:

Draft