Copied to clipboard

Flag this post as spam?

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


  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Mar 11, 2013 @ 23:29
    Rusty Swayne
    0

    Umbraco 6 library.GetPreValueAsString

    When using the Umbraco 6 API is there an equivalent to the library.GetPreValueAsString method?

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Mar 22, 2013 @ 17:05
    Rusty Swayne
    1

    // this will return a of all values (string) for the DataTypeId (int)

     ApplicationContext.Services.DataTypeService.GetPreValuesByDataTypeId(id)

  • Bill 43 posts 65 karma points
    Dec 23, 2013 @ 13:21
    Bill
    0

    Thats not what he wants - is there an easy way to convert a prevalue to the corrosponding string?

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Dec 23, 2013 @ 13:52
    Jeavon Leopold
    0

    I don't think there is one, personally I think there should be a method on UmbracoHelper, vote on this old(ish) issue http://issues.umbraco.org/issue/U4-1752

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Feb 21, 2014 @ 12:31
    Jeavon Leopold
    0

    Hi again, I just submitted a pull request for to add a method the @Umbraco helper, but there is a method on the DataTypeService you can use, e.g.

    @if (Model.Content.HasValue("character"))
    {        
        var ds = ApplicationContext.Services.DataTypeService;
        var preValue = ds.GetPreValueAsString(Model.Content.GetPropertyValue<int>("character"));
        <p>@preValue</p>
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft