HI All,
I have the following code that doesnt seem to work and im unsure why:
This part seems to populate everything as expected
//get all trading Year Pages where the archive all properties is not set to true
var activeTradingYears = siteRoot.Descendants("tradingYearPage").Where("archiveAllProperties !=true");
//create a new list to hold a complete list of all property listings
Umbraco.Web.Models.DynamicPublishedContentList fullPropertyListing = new Umbraco.Web.Models.DynamicPublishedContentList();
//for each item in the active trading year list
foreach (var tradingYear in activeTradingYears)
{
//get the trading years decendants of doc type property listing page
var tradingYearPropertyList = tradingYear.Descendants("propertyListingPage");
//loop through each property in the trading year property list
foreach (var property in tradingYearPropertyList)
{
//add them to my full property list
fullPropertyListing.Add(property);
}
}
but when i call the properties for each property in my fullPropertyList e.g. property.propertyTitle i get an error saying Umbraco.Web.Models.DynamicPublishedContentList does not contain a definition for my property method.
<div class="row">
<!-- featured listing info -->
@foreach (var property in fullPropertyListing)
{
<div class="col-md-4 col-sm-4">
<div class="featured-item">
<img class="img-responsive" src="img/house1.jpg" alt="">
<div class="heading">@property.propertyTitle</div>
<div class="content">
<address>@property.propertyAddress</address>
<div class="item-info">
<div class="row">
<div class="col-md-6 col-sm-6">
<div class="more">
<a id="item1" href="@Umbraco.NiceUrl(property.Id)" class="property-link">View Details</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
}
</div>
Can someone please point out whats going on please?
Many thanks
Paul
This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/75378-can-someone-please-explain-why-this-razor-wont-work-with-dynamiccontentlist