How do I get DocumentType Property Values out of Umbraco Into My User Control
I have a documentType that has 2 properties. I want to use the value of those properties in my user control, and I want to accomplish this in the "code behind" of my user control e.g. :
I realize I need to reference the proper UMB .DLLs in my project & expose the DocType Property Value in a public property. However I need to get the value of the property before I can expose it.
in the frontend avoid the usage of the umbraco.cms.businesslogic.web.document cause this makes more than one call to the db. As Jesper mentioned use the umbraco.presentation.nodeFactory namespace. Dirk has a good blog post on this: http://www.netaddicts.be/articles/document-api-vs-nodefactory.aspx
How do I get DocumentType Property Values out of Umbraco Into My User Control
I have a documentType that has 2 properties. I want to use the value of those properties in my user control, and I want to accomplish this in the "code behind" of my user control e.g. :
<div id="UmbProperty1Output">
<% theValueOfAnUMBDocTypeProperty %>
</div>
I realize I need to reference the proper UMB .DLLs in my project & expose the DocType Property Value in a public property. However I need to get the value of the property before I can expose it.
Thanks in advance UMB Experts.
Hi
this is what i would do: Add two Propertys to your UserControl the first is to get the current Page Id
the second is to get the value of your property (replace "MY_PROPERTY" with the correct name!):
After that you can use the code in your question to bind the Value.
Hope this helps
Toby
You can access the current node from umbraco.presentation.nodeFactory.Node like this:
Regards
Jesper Hauge
Hi,
in the frontend avoid the usage of the umbraco.cms.businesslogic.web.document cause this makes more than one call to the db. As Jesper mentioned use the umbraco.presentation.nodeFactory namespace. Dirk has a good blog post on this: http://www.netaddicts.be/articles/document-api-vs-nodefactory.aspx
hth, Thomas
and again learned something ;)
thank you guys!
Thanks guys I'll attempt the solutions today and report my feedback... I'll of course spread the love when by voting.
Another simple option: umbraco.library.GetItem('alias')
is working on a reply...