I've been trying various options to add values to a custom checkbox list datatype property in a document as part of a content import process but so far none of them have worked. I have checked the database and seen that the data is stored in the following format:
However when I check the database nothing has been stored. Has anyone got any idea how I can go about doing this or why this is not currently working? The database datatype is currently set to Nvarchar.
Thank you for the response Paul but unfortunately I don't think I've made myself clear in what i'm trying to achieve.
I have created a document type that has a number of properties one of which is a custom checkbox list type with a set of predefined values. My import process is then creating a series of content pages using this document type and populating the properties from values held in a database and then publishing the page. The problem is trying to set the values in the checkbox list from the data held in the database.
If I create a page using this content type via the dashboard and then select some of the checkbox list items before publishing the page I have seen that the selected items are stored within the text of the xml column of the cmsContentXml table for the particular node id in this format:
Programatically adding values to a checkbox list
I've been trying various options to add values to a custom checkbox list datatype property in a document as part of a content import process but so far none of them have worked. I have checked the database and seen that the data is stored in the following format:
<data alias="myAlias"><![CDATA[item1,item2,item4]]></data>
I have used the following variations in code to store some imported values:
However when I check the database nothing has been stored. Has anyone got any idea how I can go about doing this or why this is not currently working? The database datatype is currently set to Nvarchar.
Andy -
An indirect solution for you from my similar solution to a list box type. This is implemented as a User Control and wrapped as a Custom Data Type.
First, when the control loads we populate the list:
the, we add items to the list based on an action (button click or similar):
Certainly, room for improvement, but hopefully a start.
-Paul
Thank you for the response Paul but unfortunately I don't think I've made myself clear in what i'm trying to achieve.
I have created a document type that has a number of properties one of which is a custom checkbox list type with a set of predefined values. My import process is then creating a series of content pages using this document type and populating the properties from values held in a database and then publishing the page. The problem is trying to set the values in the checkbox list from the data held in the database.
If I create a page using this content type via the dashboard and then select some of the checkbox list items before publishing the page I have seen that the selected items are stored within the text of the xml column of the cmsContentXml table for the particular node id in this format:
<data alias="myAlias"><![CDATA[item1,item2,item4]]></data>
I have been attempting to recreate this progamatically as shown above but so far have not had any success.
You have to add the Values (integers) as list into the property:
"74,75,76" instead of "item1,item2,item3"
Thomas
Thanks Thomas, just had this revelation myself. There are days when I think I shouldn't be allowed to sit in front of a computer.
LOL
is working on a reply...