Geting PreValues from Umbraco Data Type

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)

New project now live ST220 ENTHUSIASTS

I have just pushed my latest project live for the group ST220 ENTHUSIASTS.

It is a mobile friendly Umbraco CMS based website, the front end has been written using Bootstrap, jQuery, Now UI, AJAX and the Razor template engine.

The underlying code is the Umbraco CMS system which runs on Dot Net Framework 4.7 (C#).

Some of the code i used in the site has come from a really useful resource

The site can be found here:

Recursivly Include In Visual Studio

When ever i build with Umbraco i find that i have to manually include files / folders into Visual Studio to be able to edit them with intellisense.

The is especially helpful when working with Views, to add the Views folder and all items under it recursively to Visual Studio just follow my tips below:

Unload your project by right clicking on your project name and clicking on Unload Project

Next right click your project name and click Edit PROJECTNAME.csproj

Once you have opened this file remove any lines containing the following:

<Content Include="Views

then when you have done that include the following line:

<Content Include="Views\**" />


Then just simply save the file, right click on your project name and then Reload Project.

All of your files under Views should now be included in your project and usable with intellisense.

Umbraco Build Error - New Installation From NuGet

One really annoying bug yet to be solved on a fresh install of Umbraco from NuGet in Visual Studio is the following build error:

CSC : warning AD0001: Analyzer 'Microsoft.CodeAnalysis.CSharp.Analyzers.FixAnalyzers.CSharpFixerWithFixAllAnalyzer' threw an exception of type 'System.TypeInitializationException' with message 'The type initializer for 'Microsoft.CodeAnalysis.Analyzers.FixAnalyzers.FixerWithFixAllAnalyzer`1' threw an exception.'.

This is really easily solved, 1 NuGet package needs updating to remove this issue, simply open Manage NuGet Packages go to the Installed tab and search for the following:


And them simply update to the latest version.

Hopefully they will roll this out as a fix eventually, I have raised this with them on their forums with no reply.

Save 20% on G Suite Basic or Business

Using one of my codes below you can save 20% off the first year of G Suite Basic or G Suite Business.

(These codes are on a first come first served basis)

My Referal Link (You must use this link for the codes to work):

Then use one of the following codes:

G Suite Basic Plan (20% off first year):


G Suite Business Plan (20% off first year)