This however returns the following error when debugging my macro:
Error loading XSLT ChangeRequests/ChangeRequestBPOProcessRequest.xslt The type or namespace name 'umbraco' could not be found (are you missing a using directive or an assembly reference?)
Is this possible ? If so can someone advise assembly references I need.
The alternative is to generate a unique ID and store on my node when created - this would then be a doddle to retrieve.
I look forward to someone more knowledgeable than I sharing their wisdom.
Easiest thing to do is moved the code to it's own class in the App_Code folder, marked with an XsltExtension attribute. (Ideally you'd want this as a compile DLL in the bin folder - but that's down to how comfortable you are with Visual Studio, etc).
As for the function itself, I've been looking around for an existing code snippet - but couldn't find anything similar ... I'm tempted to add one to uComponents! ;-)
Inline C# code to retrieve unique ID of node
Hi there
I was wanting to retrieve the unique ID for a node from the UmbracoNode table. This information is not stored in the umbraco.config file.
So below is my code
This however returns the following error when debugging my macro:
Is this possible ? If so can someone advise assembly references I need.
The alternative is to generate a unique ID and store on my node when created - this would then be a doddle to retrieve.
I look forward to someone more knowledgeable than I sharing their wisdom.
Cheers
Nigel
Hi Nigel,
Quick answer to the error is to add the assembly references too:
...
Longer answer ... I advise that you don't use inline code snippets from within your XSLT - it is "bad practice" (read the comments of Doug's blog post about it).
Easiest thing to do is moved the code to it's own class in the App_Code folder, marked with an XsltExtension attribute. (Ideally you'd want this as a compile DLL in the bin folder - but that's down to how comfortable you are with Visual Studio, etc).
As for the function itself, I've been looking around for an existing code snippet - but couldn't find anything similar ... I'm tempted to add one to uComponents! ;-)
Cheers, Lee.
Hi Lee
Thanks for the fantastic information - solves my small issues nicely.
I will definitely look to "DLL" the functionality - I have a subscription to Umbraco TV at work so will take a look at that link there.
Cheers again.
Nigel
Hi Nigel,
Just so you know for future reference, I've added this function to uComponents (will be in v2.2) - in the Nodes extensions.
Cheers, Lee.
is working on a reply...