Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Lee Allan 11 posts 31 karma points
    Mar 27, 2012 @ 13:24
    Lee Allan
    0

    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.

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Mar 27, 2012 @ 14:31
    Tom Fulton
    0

    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

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies