Copied to clipboard

Flag this post as spam?

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


  • Edwin 16 posts 96 karma points
    Oct 03, 2016 @ 21:00
    Edwin
    0

    Getting custom property value from post

    I'm having trouble figuring out how to get the value of a custom property I added to the ArticulatePost document type. I added a property by the name of "Category" and it's type is Textbox. It's intended to be a text value that contains a single main category for a post independent of the category tags. For each of my posts (I only have 11) I added a value for the "Category" property. I'm trying to reference this property in Lists.cshtml but it comes up empty for each of my posts where I set the value. Using @post.HasProperty("category") returns true but when I try @post.GetPropertyValue("category") I get nothing. I verified in the database that the values I entered for this property for each post are there but I haven't found a way to retrieve them.

    Any help would be greatly appreciated.

    Thanks,

    Edwin

  • Edwin 16 posts 96 karma points
    Oct 03, 2016 @ 22:19
    Edwin
    0

    Figured out what I was doing wrong. The value was be retrieved correctly, I just wasn't using the right logic to display it on the page.

  • Adnan Osfira 13 posts 103 karma points
    Oct 03, 2016 @ 22:35
    Adnan Osfira
    0

    Hi Edwin

    The used model in list.cshtml view is Articulate.Models.listModel and this model represents collection of post model type.

    The post model type represents only primary Articulate post attributes , not any added custom attribute.

    So You can't get value from your custom property without changing the Articulate source code ,particularly post model

    Adnan

Please Sign in or register to post replies

Write your reply to:

Draft