Nibble

Fetching the nodeid in a custom datatype

Just a quick tip following the custom datatypes posts (Creating custom umbraco datatypes , Storing parseable xml data in a datatype ).

When creating a datatype you might at some point need to have the current document’s nodeid. Like if you want to insert some extra data in a custom table.

Since the datatypes are also used by autoform/doc2form , liveediting and not only in the umbraco backend the best approach is to fetch it like this:

((umbraco.cms.businesslogic.datatype.DefaultData)_data).NodeId

2 Comments so far

  1. Kenneth Solberg on December 1st, 2008

    Good to know, though not if you’ve implemented your custom datatype as a usercontrol wrapped in the usercontrol wrapper datatype.

  2. Juan David on October 8th, 2010

    Thanks :)

Leave a Reply