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> }
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?
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
I think you are just looking for @childPage.GetPropertyValue("MyCustomTextField ")
Andy
Thanks Andy,
Learning razor, could not find anything about it on forum.
is working on a reply...