save multiple values with Umbraco UserControl Wrapper
HI,
I have created a custom datatype using the Umbraco UserControl Wrapper. I have a CheckBox List (populated from SQL), and want to save multiple values back to Umbraco.
How can I acheive this? What does the umbracoValue variable do? Can it only save a string back to Umbraco database? Can I save multiple values, as determined by the checked Checkboxes?
You can only save a string, but you have some options when using multiple values. You can store the values as a CSV string (1101,1102,1103) or you can store XML (<nodes><nodeId>1101</nodeId>...</nodes>). To store XML you just build the XML string and set it to your umbracoValue - if Umbraco detects an XML value it will save it as such and you can query it easily from XSLT.
This blog post also talks about a way to do XML Serialization, though the above method will work. The CSV may be simplest depending on your needs though.
save multiple values with Umbraco UserControl Wrapper
HI,
I have created a custom datatype using the Umbraco UserControl Wrapper. I have a CheckBox List (populated from SQL), and want to save multiple values back to Umbraco.
How can I acheive this? What does the umbracoValue variable do? Can it only save a string back to Umbraco database? Can I save multiple values, as determined by the checked Checkboxes?
Thanks.
Lee.
Hi Lee,
You can only save a string, but you have some options when using multiple values. You can store the values as a CSV string (1101,1102,1103) or you can store XML (<nodes><nodeId>1101</nodeId>...</nodes>). To store XML you just build the XML string and set it to your umbracoValue - if Umbraco detects an XML value it will save it as such and you can query it easily from XSLT.
This blog post also talks about a way to do XML Serialization, though the above method will work. The CSV may be simplest depending on your needs though.
-Tom
is working on a reply...