If you want to fetch the values directly on your templates then you can use UmbracoItems, which can be inserted using the context menu in the template.
Don't know the C# syntax though but it should be possible to find in the documentation somewhere :)
Could you ellaborate a bit about what you want to do by fetching the properties dynamically?
Using the node factory you should be able to obtain the currentnode id and the use it to loop over any children, grandchildren etc. and fetch their ID's etc.
var document = new Document(1234); foreach(var p in doc.getProperties){ var value = p.Value; var alias = p.PropertyType.Alias; }
But I think you will always need some 'hardcoding'. Is there a specific functionality you want to create? Maybe someone has a better solution for the specific problem?
Dynamically fetch default properties of a node
Hi,
How can i retrieve node's default properties like ID,Create Date,CreatorName etc dynamically?
Thanks
Hi Manasa
What language do you want to use for doing it? It can be done with XSLT, Razor, C# and Umbraco:Items.
Razor: Model.Id, Model.CreateDate, Model.Date, Model.CreatorName or @CurrentPage.Id, @CurrentPage.CreateDate, @CurrentPage.Date, @CurrentPage.CreatorName
Xslt $currentPage/@id, $currentPage/@createDate, $currentPage/@date, $currentPage/@creatorName
If you want to fetch the values directly on your templates then you can use UmbracoItems, which can be inserted using the context menu in the template.
Don't know the C# syntax though but it should be possible to find in the documentation somewhere :)
Hope this helps.
/Jan
Hi Jan,
I'm using C# to retrieve properties.
Thanks
Hi Manasa,
Maybe this documentation about the NodeFactory can help you.
http://our.umbraco.org/wiki/reference/api-cheatsheet/working-with-nodefactory
/Dennis
Displaying default properties in checkboxlist
Hi Dennis,
Is there any way where i need not hardcode the property names?
Instead fetch them dynamically.
Thanks
Hi Manasa
Could you ellaborate a bit about what you want to do by fetching the properties dynamically?
Using the node factory you should be able to obtain the currentnode id and the use it to loop over any children, grandchildren etc. and fetch their ID's etc.
/Jan
Do you want something like this?
(Didn't test it)
Hi Bert,
Is there a way to mention property names (creatorName,createDate) without hardcoding their names?
Thanks
In version 4 you could do something like this:
But I think you will always need some 'hardcoding'. Is there a specific functionality you want to create? Maybe someone has a better solution for the specific problem?
Thanks Bert. :)
is working on a reply...