Copied to clipboard

Flag this post as spam?

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


  • Fred 14 posts 74 karma points
    Sep 02, 2015 @ 09:05
    Fred
    0

    Populating custom DropDown propety

    Hello,

    I'm uploading files to umbraco using the ContentService API. It's all currently working fine but i'm having trouble with DropDown

    IContent contentNode;
    
    contentNode.SetValue("date", myitem.ExpiryDate); // populates a date
    contentNode.SetValue("reference", myitem.Reference); // populates a text box
    contentNode.SetValue("status", "Online"); // remains empty
    

    status is a custom property of the datatype "Status" which is a "Dropdown List" with 3 values; "Online, Approval, Offline".

    Any helps appreciated, is a dropdown list the right datatype i want? there were 4 to choose from.

    Thanks, Fred

    edit: version is 7.2.4

  • Fred 14 posts 74 karma points
    Sep 02, 2015 @ 10:05
    Fred
    0

    Tested out the Dropdown with publishing keys.

    This worked if i set the value to 18,19 or 20. Not sure how good this will be, this script will be run on another site and so not reusable.

    This value is stored in cmsDataTypePreValues and I could reverse the process to get the ID from the value by string matching and use this, but I think this is too complicated for something that may be simple.

  • Fred 14 posts 74 karma points
    Sep 02, 2015 @ 12:48
    Fred
    100

    Incase anyone gets stuck on the same thing, managed to find an old post that did the trick, shame you can't do it built in.

    https://our.umbraco.org/forum/umbraco-7/using-umbraco-7/54217-Dropdown-Custom-Member-Properties

Please Sign in or register to post replies

Write your reply to:

Draft