Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I need to get the PropertyType of a Property in my usercontrol.
The Property is specified by using the propertyTypePicker macro control, so I have the Alias.
I knwo I can get the ID by using PropertyType.GetPropertyType(), but then I need the ID, not the Alias.
The Umbraco XML doesn't store the information about the property type, you have to map it back to the actual Document object
Thanks! That got me on the right track.
Solved it by doing the following:
Document d = new Document(Node.GetCurrent().Id);// Get Property Alias from MacroPropertyType pt = d.getProperty(this.PropertyAlias).PropertyType;// Get PrevaluesSortedList prevalues = PreValues.GetPreValues(pt.DataTypeDefinition.Id);
You don't want to be running that code too often, I think that does 3 database calls to get what you need and that's just unavoidable from the current Umbraco design.
It could be solved by entering the datatype id as a macro parameter.
Then I can get the prevalues without going the heavy way.
If you come up with a better suggestion, don't hestitate to tell me =)
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Get PropertyType of a Node Property
I need to get the PropertyType of a Property in my usercontrol.
The Property is specified by using the propertyTypePicker macro control, so I have the Alias.
I knwo I can get the ID by using PropertyType.GetPropertyType(), but then I need the ID, not the Alias.
The Umbraco XML doesn't store the information about the property type, you have to map it back to the actual Document object
Thanks! That got me on the right track.
Solved it by doing the following:
You don't want to be running that code too often, I think that does 3 database calls to get what you need and that's just unavoidable from the current Umbraco design.
It could be solved by entering the datatype id as a macro parameter.
Then I can get the prevalues without going the heavy way.
If you come up with a better suggestion, don't hestitate to tell me =)
is working on a reply...