Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bilal khan 35 posts 58 karma points
    Jan 29, 2015 @ 18:48
    Bilal khan
    0

    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

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies