RenderTemplate, Razor & calling page node id


How do I get the node id of the page that called the RenderTemplate function from within the template being rendered? Using Model.Id in Razor (understandably) gives me the Id of the node that is being rendered not the one that called RenderTemplate.
Closed Jan 20, 2012 at 12:46 AM by
Solution implemented in changeset 87493 - added HttpItem called "umbCallingPageId", this references the nodeId of the calling page.

To be released in v3.0.2


leekelleher wrote Jan 19, 2012 at 11:11 AM

I've got a fix for this... (in changeset: 87493). Added a HttpItem called "umbCallingPageId" that contains the nodeId of the calling page. In Razor it could be accessed using:

var callingPageId = umbraco.library.GetHttpItem("umbCallingPageId")

mblisscouk wrote Jan 19, 2012 at 11:42 AM

Perfect Lee, that really increases the possibilities with RenderTemplate
Many thanks

mblisscouk wrote Feb 2, 2012 at 12:38 PM

Help for anyone upgrading from 3.0 to 3.02! With this upgrade any existing macros that uses the RenderTemplate .Net Custom Control will throw an error. The solution is to remove all parameters from the macro and then 'Browse Properties' again to recreate them. This is because the new verison of the custom control take all parameters as strings and the previous version did not.