Copied to clipboard

Flag this post as spam?

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


  • Kyle Jorve 11 posts 94 karma points
    Jan 07, 2020 @ 00:40
    Kyle Jorve
    0

    Get All Possible Values in Dropdown

    Hi! I'm trying to get all the possible options in a dropdown list and put them in an enumerable variable in the front end code (.cshtml). I believe these are called prevalues? Not sure.

    There was a way to do this in Umbraco 7, but I can't find how to do this in 8. Halp?

  • Marc-André 63 posts 276 karma points
    Jan 17, 2020 @ 16:37
    Marc-André
    1

    Hi Kyle.

    This is how I make it works :

    @{
              var _dataTypeService = Services.DataTypeService;
              var blogCategories = (DropDownFlexibleConfiguration)_dataTypeService.GetDataType(1142).Configuration;
              foreach (var value in blogCategories.Items)
              {
                <option value="@value.Value">@value.Value</option>
              }
            }
    
  • 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