I have a points property on a Task doctype set up as a nuPickers.XmlRadioButtonPicker, saving as XML.
I'm trying to set the value of this from code, using something like this:
var newTask = contentService.CreateContent("Task Title", newCard.Id, "Task");
if (newTask != null) {
newTask.SetValue("points", 13);
contentService.SaveAndPublishWithStatus(newTask);
}
This actually saves, and the property is saved as "13", but it's not displaying correctly in the Backoffice, because it's supposed to store a chunk of XML instead, akin to this:
Thanks - and I think you're totally right - I've verified that "just" saving the XML I know has to go there works, but I hope I can get my head around using the Property Editor Value Converter (or something similar) to do the dirty work of looking the value up and serializing it properly. That way it should continue to work if someone decides to change the data type from saving as XML, to say, JSON in the future... (I guess :-)
How to set nuPickers property value from code?
Hi all,
I have a points property on a Task doctype set up as a nuPickers.XmlRadioButtonPicker, saving as XML.
I'm trying to set the value of this from code, using something like this:
This actually saves, and the property is saved as "13", but it's not displaying correctly in the Backoffice, because it's supposed to store a chunk of XML instead, akin to this:
How do I correctly save a "picked" value to a property?
/Chriztian
Hi Chriztian,
I think nuPickers stores it value in a specific format.
Maybe you can use the steps in this article to save your data.
http://24days.in/umbraco/2014/working-with-complex-archetype-datatypes/
This article is about archetype, but I think the same principle would apply to nuPickers as well.
Dave
Hi Dave,
Thanks - and I think you're totally right - I've verified that "just" saving the XML I know has to go there works, but I hope I can get my head around using the Property Editor Value Converter (or something similar) to do the dirty work of looking the value up and serializing it properly. That way it should continue to work if someone decides to change the data type from saving as XML, to say, JSON in the future... (I guess :-)
/Chriztian
Yeah...who uses XML and XSLT anyway :-)
Dave
I do!! :-)
Really...never would have guessed that :-p
is working on a reply...