Copied to clipboard

Flag this post as spam?

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


  • René Andersen 238 posts 684 karma points
    Jun 03, 2013 @ 13:04
    René Andersen
    0

    Insert "mailto" in Html.Raw

    Hi

    Is it possible to add in:

    <a href="mailto:[email protected]">Send Mail</a>

    In this:

    @Html.Raw(Model.GetPropertyValue("email", true))

    I have tried this below, but with no luck:

    <a href="mailto:@Html.Raw(Model.GetPropertyValue("email", true))>Send Mail</a>


    Thanks in advance.

    //René

  • Jeavon Leopold 3074 posts 13631 karma points MVP 11x admin c-trib
    Jun 03, 2013 @ 13:27
    Jeavon Leopold
    100

    Hi René,

    I'm pretty sure you are using typed MVC so I think you need to use:

    <a href="mailto:@Model.Content.GetPropertyValue("email", true)">Send Mail</a>

    If you are using a classic Razor Macro then it would be:

    <a href="mailto:@Model._email">Send Mail</a>

    Thanks,

    Jeavon

  • René Andersen 238 posts 684 karma points
    Jun 03, 2013 @ 13:47
    René Andersen
    0

    Hi Jeavon,

    Perfect you just solved my problem. I used your first example with a minor change. See below

    <a href="mailto:@Model.GetPropertyValue("email", true)">Send Mail</a>

    Thanks for your help,

    //René

  • Jeavon Leopold 3074 posts 13631 karma points MVP 11x admin c-trib
    Jun 03, 2013 @ 13:52
    Jeavon Leopold
    0

    Hi René,

    That's great! I'm guessing this is going into a Partial View rather than a View then?

    Thanks,

    Jeavon

  • René Andersen 238 posts 684 karma points
    Jun 03, 2013 @ 14:05
    René Andersen
    0

    Hi Jeavon,

    That's correct. :-)

    //René

Please Sign in or register to post replies

Write your reply to:

Draft