Copied to clipboard

Flag this post as spam?

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


  • Ras 66 posts 330 karma points
    Nov 16, 2023 @ 08:45
    Ras
    0

    Get the available values of a specific data type in a controller?

    I'm trying to get the values of a checkboxlist but I can't seem to figure it out.

    I can get the actual property type from my document type like so

      var productionPage = _contentTypeService.Get(ProductionPage.ModelTypeAlias);
      var propertyType = productionPage.PropertyTypes.FirstOrDefault(x => x.Alias == "ageGroups");
    

    But after that I can't find any way to actually see what options the checkboxlist has? How can i achieve this?

  • Huw Reddick 1929 posts 6717 karma points MVP 2x c-trib
    Nov 16, 2023 @ 18:08
    Huw Reddick
    100

    Try something like

    dataTypeService.GetPreValuesCollectionByDataTypeId(propertyType.DataTypeDefinitionId)

  • Ras 66 posts 330 karma points
    Nov 20, 2023 @ 09:58
    Ras
    0

    I did end up doing something similar to this, but I'll mark this as the solution as it's the correct method to use

Please Sign in or register to post replies

Write your reply to:

Draft