XPathNodeIterator iterator2 = umbraco.library.GetPreValues(1075);
iterator2.MoveNext(); //move to first
XPathNodeIterator preValues2 = iterator2.Current.SelectChildren("preValue", "");
while (preValues2.MoveNext())
{
string preValue2 = preValues2.Current.Value;
int preValueId2 = preValues2.CurrentPosition;
ListeOfTeamNumbers.Add(new SelectListItem
{
Text = preValue2,
Value = preValue2
});
modal.ListeOfTeamNumbers = ListeOfTeamNumbers;
which will grab the datatype i have and send the values to a dropdownlist. This Works perfectly, but then when i want to grab the value and add it inside my ContentService.CreateContent like this
Do you get an error when you do this? Or do you just get unexpected results? Can you send over more details on what happens when you try to create the new content using the ContentService?
Yeah sure, well everything goes through fine, but in my backend on the newly created node, none of the properties are filled with the information, they just appear blank
Nevermind, after really digging through the internet today i found my solution.
// Årgang is the name of my datatype, NOTE the name not the Alias
// and the modal.SelectedYear is the value im passing into the controller from my view's selected dropdown value
DataTypeService myService = new DataTypeService();
var SelectedYear = myService.GetAllDataTypeDefinitions().First(x => x.Name == "Årgang");
int SelectedYearPreValueId = myService.GetPreValuesCollectionByDataTypeId(SelectedYear.Id).PreValuesAsDictionary.Where(x => x.Value.Value == modal.SelectedYear).Select(x => x.Value.Id).First();
Custom DataType into ContentService
I have the following code
which will grab the datatype i have and send the values to a dropdownlist. This Works perfectly, but then when i want to grab the value and add it inside my ContentService.CreateContent like this
Do you get an error when you do this? Or do you just get unexpected results? Can you send over more details on what happens when you try to create the new content using the ContentService?
Yeah sure, well everything goes through fine, but in my backend on the newly created node, none of the properties are filled with the information, they just appear blank
Nevermind, after really digging through the internet today i found my solution.
is working on a reply...