Copied to clipboard

Flag this post as spam?

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


  • elitenet 2 posts 32 karma points
    Dec 23, 2013 @ 19:15
    elitenet
    0

    custom field in childPage

    Hi umbracos

    I have used one of the razor templates.
    I have made a new custom text field on a page and I want to call it.
    How can I do this?

    @inherits umbraco.MacroEngines.DynamicNodeContext


    @* Ensure that the Current Page has children, where the property umbracoNaviHide is not True *@
    @if (Model.Children.Where("Visible").Any())
    {
    <ul>
    @* For each child page under the root node, where the property umbracoNaviHide is not True *@
    @foreach (var childPage in Model.Children.Where("Visible"))
    {
    <li>
    <a href="@childPage.Url">@childPage.Name</a>
    </li>
    }
    </ul>
    }


       

    I want to put the code (childPage.MyCustomTextField ??) in here, but I imagine its something like this, but it does not work:


    @inherits umbraco.MacroEngines.DynamicNodeContext


    @* Ensure that the Current Page has children, where the property umbracoNaviHide is not True *@
    @if (Model.Children.Where("Visible").Any())
    {
        <ul>           
            @* For each child page under the root node, where the property umbracoNaviHide is not True *@
            @foreach (var childPage in Model.Children.Where("Visible"))
            {
                <li>
                    <a href="@childPage.Url">@childPage.MyCustomTextField </a>
                </li>
            }
        </ul>
    }


    How can I call the custom field?


    // umbraco 6.1.6, ucomponent

  • Andy Butland 422 posts 2334 karma points MVP 4x hq c-trib
    Dec 24, 2013 @ 21:53
    Andy Butland
    100

    I think you are just looking for @childPage.GetPropertyValue("MyCustomTextField ")

    Andy

  • elitenet 2 posts 32 karma points
    Dec 25, 2013 @ 11:59
    elitenet
    0

    Thanks Andy,

    Learning razor, could not find anything about it on forum.

     

     

Please Sign in or register to post replies

Write your reply to:

Draft