Aaron Sadler
Posted by:

Aaron Sadler



I thought i would share the solution to getting the pre values from a Data Type, as the documentation for this on the Umbraco website seems to have been removed.

The code below is an edited version of what worked for me (to remove the project details).

You will need to replace NAME or name with your values to make this work correctly, however it should point in the right direction.

public ActionResult NAME()
    return PartialView("~/Views/Partials/NAME.cshtml", new MODELNAME{NAME = GetSelectListForNAME()});

private SelectList GetSelectListForNAME()
    var preValueDataType = Umbraco.DataTypeService.GetPreValuesCollectionByDataTypeId(1301); //Change Data Type ID
    var preValues = preValueDataType.PreValuesAsDictionary.Values.Where(pdv => pdv.Value != "0");

    var namesList = preValues.Select(preValue => new SelectListItem
            Value = preValue.Id.ToString(),
            Text = preValue.Value
    return new SelectList(namesList);


public SelectList NAMES { get; set; }

public string NAME { get; set; }

Razor View

This will populate a drop down list

@Html.DropDownListFor(model => model.NAME, Model.NAMES.Items as List)

Post a comment

Fields marked with an * (asterisk) are required

Recent Posts

How to pass a Content Security Nonce (CSP) to G...

How to use a CSP nonce with...

UmbCheckout 1.0.0 & UmbCheckout.StarterKit.Stri...

The stable version of UmbCh...

Voting is now open for the Green Business of th...

We've been shortlisted! - P...

We have been shortlisted in The Petersfield Awa...

We have been shortlisted fo...

Please nominate us in The Petersfield Awards!

If you believe in what we d...

Browse Umbraco Hosting

Umbraco Hosting Starting At $26/month