I am new to Umbraco and Razor. I have built a some page slike this
Records table Record item 1 Record item 2 Record item 3
I have this razor script which sits in the 'Records table' template
@foreach (var page in @Model.Children) { <a chref="@page.Url" >@page.Name</a> }
That works, it lists out the sub pages of "Records table".
What I want to do is pull out more info not just the page name. There is a div in each of these pages which I wish to display on the 'Records table' page. So something like @page.div.wrap
You can access all the generic properties on your document type. In stead of the @page.Name you could write @page.bodyText if you have a property bodyText added to your document type.
It could look like this:
@foreach (var page in @Model.Children) {
<div>@page.bodyText</div>
}
Hope that the above example is what you were looking for.
Razor - Get HTML of child nodes
Hi,
I am new to Umbraco and Razor. I have built a some page slike this
Records table
Record item 1
Record item 2
Record item 3
I have this razor script which sits in the 'Records table' template
@foreach (var page in @Model.Children) {
<a chref="@page.Url" >@page.Name</a>
}
That works, it lists out the sub pages of "Records table".
What I want to do is pull out more info not just the page name. There is a div in each of these pages which I wish to display on the 'Records table' page. So something like @page.div.wrap
Can anyone help?
Thanks,
Simon
Hi Simon.
You can access all the generic properties on your document type. In stead of the @page.Name you could write @page.bodyText if you have a property bodyText added to your document type.
It could look like this:
@foreach (var page in @Model.Children) {
<div>@page.bodyText</div>
}
Hope that the above example is what you were looking for.
/Christian
This worked great, thanks a lot Christian
is working on a reply...