Copied to clipboard

Flag this post as spam?

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


  • philw 99 posts 434 karma points
    Jun 07, 2014 @ 14:48
    philw
    0

    Absolute beginners: adding a field and using it

    I've use UMB 7, but I'm new to 7 and I guess this is so simple that I can't find the answer to it.

    I added a field to my document type, no problems with that, same as UMB6. But when I try to use it, I get the yellow screen of death, or nothing. Let's call the field "NewField" and it's a multi-line text field.

    (1) This gives a YSOD:

     @if (string.IsNullOrWhiteSpace(CurrentPage.NewField) == false) { ...}

    (2) and this just doesn't ever return true:

      @if(CurrentPage.HasValue("NewField")){ ... }

    Please feel free to tell me to RTFM, but which manual would that be? I'm looking everywhere I can...

  • philw 99 posts 434 karma points
    Jun 07, 2014 @ 15:41
    philw
    100

    Ok, got it, here's the manual:

    http://our.umbraco.org/documentation/reference/Templating/Mvc/views

     

    @Umbraco.Field("fieldName", insertBefore: "<h2>", insertAfter: "</h2>")

Please Sign in or register to post replies

Write your reply to:

Draft