I have an archtype called videos added to my page I am trying to retreive this within a function in my controller but I am getting a null value Below is the code.
public List<GenericContent> VideoList ()
{
var archetypeModel (This is null)= CurrentPage.GetPropertyValue<ArchetypeModel>("videos");
How to get Archetype within a controller
Hi
I have an archtype called videos added to my page I am trying to retreive this within a function in my controller but I am getting a null value Below is the code.
public List<GenericContent> VideoList ()
{
var archetypeModel (This is null)= CurrentPage.GetPropertyValue<ArchetypeModel>("videos");
var List = new List<GenericContent>();
return archetypeModel.Select(x =>
{
return new GenericContent()
{
Title = x.GetValue<string>("title"),
Content = x.GetValue<IHtmlString>("videoContent"),
};
}
).ToList();
}
When I use the below inside my model then the archetype is not null
var archetypeModel = CurrentPage.GetPropertyValue<ArchetypeModel>("videos");inside my model the archtype
Thanks
in Advance
is working on a reply...