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 want to identify which property is used for every properties? example in umbraco page i have added four properties with suitable controls (like text box check boxes, optional, text area). so here when i retrieve all umbraco properties in web page i want to know each property has which type
Is that possible any properties is available to differentiate instead of UmbracoDefinitionDatatypeId ?
If I understand the question correctly, you should be able to use the GetProperty([alias]) method on content to get information about a property.
I hope this helps.
Thanks for the update.
Actually i have N number of properties in a content and iam trying to access one by one. So in this i want to check each property data type.
How can i get each property data type?
If you are using modelsbuilder you could use reflection to get all the properties.
Another way is to look as the ContentType which exposes a PropertyTypes-collection.
You should not use the ApplicationContext.Services (ContentService etc) for this, since that will do lookups in the database.
You are right about the ContentType.
Should be able to access all the data like this.
var propTypes = Model.Content.ContentType.PropertyTypes;
foreach (var type in propTypes)
var editorAlias = type.PropertyEditorAlias;
var typeAlias = type.PropertyTypeAlias;
var value = Model.Content.GetPropertyValue(typeAlias);
I do not think this is possible in a good way.
The property type is not saved in the cache so you would have to use the content service, but that of course talks straight to the sql and would never recommend using it in a view but you could read the data and store it in a cache that you could use later in a view.
Here is an example how you could use the content service to fetch the data in a view.
var cs = ApplicationContext.Current.Services.ContentService;
var content = cs.GetById(Model.Content.Id);
var properties = content.Properties;
foreach (var p in properties)
var type = p.PropertyType;
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted