I get a YSOD on the line @item.PortfolioItemCoverPhoto
Why cant I display document type attributes of my portfolio items? (There are currently two portfolio items with various attributes of PotfolioItem*****").
CS1061: 'Umbraco.Core.Models.IPublishedContent' does not contain a definition for 'PortfolioItemCoverPhoto' and no extension method 'PortfolioItemCoverPhoto' accepting a first argument of type 'Umbraco.Core.Models.IPublishedContent' could be found (are you missing a using directive or an assembly reference?)
Cant display items
Consider the following code:
@{
var pageSize = 1;
var page = 1; int.TryParse(Request.QueryString["page"], out page);
var items = Umbraco.TypedContent(Model.Content.Id).Children.Where(x => x.DocumentTypeAlias == "PortfolioItem" && x.IsVisible());
var totalPages = (int)Math.Ceiling((double)items.Count() / (double)pageSize);
if (page > totalPages)
{
page = totalPages;
}
else if (page < 1)
{
page = 1;
}
}
@foreach (var item in items.Skip((page - 1) * pageSize).Take(pageSize).OrderBy(x => x.Name))
{
@item.PortfolioItemCoverPhoto
}
I get a YSOD on the line @item.PortfolioItemCoverPhoto
Why cant I display document type attributes of my portfolio items? (There are currently two portfolio items with various attributes of PotfolioItem*****").
Thanks for any input.
Kind regards.
The YSOD:
CS1061: 'Umbraco.Core.Models.IPublishedContent' does not contain a definition for 'PortfolioItemCoverPhoto' and no extension method 'PortfolioItemCoverPhoto' accepting a first argument of type 'Umbraco.Core.Models.IPublishedContent' could be found (are you missing a using directive or an assembly reference?)
Its ok figured it out.
Access the item properities using:
@item.GetPropertyValue("PortfolioItemCoverPhoto")
is working on a reply...