I'm trying to create a custom DataType that will have to store multiple values. I need the controls from this datatype to always be grouped together, as I will be accessing the different textboxes from the codebehind.
Do I really have to use a comma seperated string to save the values in the different fields or do I still have some other options?
You're not restricted in any way on how to save the values for the different boxes, but I'd go with xml, as this makes it really easy to use with xslt and such.
Btw, do you have an example of
"need the controls from this datatype to always be grouped together, as I will be accessing the different textboxes from the codebehind"
as I'm not sure what exactly you're trying to say?
@ Dirk yeah well what I really meant to say is that I would like to store three different properties but they are related. What I'm doing is:
- Using the ultimate picker to get autosuggest to find a content item - Javascript detects the pipe "|" in the string and uses the ID after the pipe to load an image from the selected content item - Selecting a coordinate on the image and putting it in a different textbox
What I need to save is the selected content item AND the coordinates. So that would be two different properties on the documentType normally.
@ fed Tim's post looks interesting, not sure how I'd go about using that though..
Sebastian, can you store tha value in a delimited format and parse it on the output? Just like you're parsing out the ID from the ultimatepicker, you could do something similar with your save/read.
Have you looked at the Dynamic Properties Datatype that i have submitted to the package list? Not sure if its what you are looking for.
This allows you create properties and property groups in the content tree. The Datatype uses this structure to create a property on your content node that gives you those nodes as fields.
eg your properties tree might look like this
property 1 Property Group ----Prop 1 ----Prop 2 ----Prop 3 Property Group 2 ----Prop 1 ----Prop 2
This would render in your content node as a list of grouped text fields like this
You are also able to set mandatory properties and have validation on the control
This then saves a XML stub into the Umbraco.Config file that you can parse with XPath or however you like. It looks like this on a node. (this is just an example and doesnt represent what I show above.
The ids on the XML nodes point at the node from the properties tree. This allows you to get the fieldnames back at display time or any other information that you want to store against the properties.
Custom DataType with multiple values
I'm trying to create a custom DataType that will have to store multiple values. I need the controls from this datatype to always be grouped together, as I will be accessing the different textboxes from the codebehind.
Do I really have to use a comma seperated string to save the values in the different fields or do I still have some other options?
Sebastiaan,
You're not restricted in any way on how to save the values for the different boxes, but I'd go with xml, as this makes it really easy to use with xslt and such.
Btw, do you have an example of
"need the controls from this datatype to always be grouped together, as I will be accessing the different textboxes from the codebehind"
as I'm not sure what exactly you're trying to say?
Cheers,
Dirk
You should check out Tim's blogpost about this http://www.nibble.be/?p=51
@ Dirk yeah well what I really meant to say is that I would like to store three different properties but they are related. What I'm doing is:
- Using the ultimate picker to get autosuggest to find a content item
- Javascript detects the pipe "|" in the string and uses the ID after the pipe to load an image from the selected content item
- Selecting a coordinate on the image and putting it in a different textbox
What I need to save is the selected content item AND the coordinates. So that would be two different properties on the documentType normally.
@ fed Tim's post looks interesting, not sure how I'd go about using that though..
Sebastian, can you store tha value in a delimited format and parse it on the output? Just like you're parsing out the ID from the ultimatepicker, you could do something similar with your save/read.
Just a thought.
Thanks,
Nik
Hi Sebastiaan
Have you looked at the Dynamic Properties Datatype that i have submitted to the package list? Not sure if its what you are looking for.
This allows you create properties and property groups in the content tree. The Datatype uses this structure to create a property on your content node that gives you those nodes as fields.
eg your properties tree might look like this
This would render in your content node as a list of grouped text fields like this
You are also able to set mandatory properties and have validation on the control
This then saves a XML stub into the Umbraco.Config file that you can parse with XPath or however you like. It looks like this on a node. (this is just an example and doesnt represent what I show above.
The ids on the XML nodes point at the node from the properties tree. This allows you to get the fieldnames back at display time or any other information that you want to store against the properties.
Hope that helps
is working on a reply...