I have managed to solved this, a version of my code is below if others have this problem.
On another note PreValues seem to have been removed from the Umbraco Wiki / Documentation
Controller:
[ChildActionOnly]
[ActionName("NAME")]
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
})
.ToList();
return new SelectList(namesList);
}
Model
public SelectList NAMES { get; set; }
public string NAME { get; set; }
Razor View
@Html.DropDownListFor(model => model.NAME, Model.NAMES.Items as List)
Member Type Pre Values
How can i pull down the pre values from the member type api to use on a registration form as a dropdown (select) box
Thanks!
I have managed to solved this, a version of my code is below if others have this problem.
On another note PreValues seem to have been removed from the Umbraco Wiki / Documentation
Controller:
Model
Razor View
is working on a reply...