Yes, all are included. The file should be in every Umbraco 7 install if I'm not mistaken. Perhaps you could try it yourself and see if it works. Pretty sure it's not my solution that is the problem though, but the method trying to collect the property.
Yes that should be there in any installations. I did try it and it works fine on mine, thats why I am asking you some obvious questions too see if anything is in its place?
int nodeId = Node.getCurrentNodeId(); var helper = new UmbracoHelper(UmbracoContext.Current);
content = helper.TypedContent(nodeId).AncestorsOrSelf(1).FirstOrDefault();
if (content != null)
{
content.GetPropertyValue("layoutColor");
}
GetProperty at backend
Hi,
I am trying to get the property value from the homepage into the backend umbraco file: Default.cshtml.
I have done it as such on the frontend:
But this doesn't seem to work in the backend files.
Hope someone knows how this can be done!
Hi,
What if you use this?
It gives me the message: There is no current node.
Strange, As long as it is bounded to a node, there must be a currentNode!
is this working?
Is Default.cshtml a view or macroscript?
It gives me the message: Object reference not set to an instance of an object.
It is a view generated by Umbraco.
Did you add the required refences?
Can you share the stack trace for your error message?
Also are you able to run your code in debug mode and check the variables there?
The last try doesn't need any references?
I can run it in debug mode but can't check the variables as it gives me the error before setting the variable.
The stacktrace:
No in last try there is no additional references is required.
Can you make sure you have following DLLs in your solution's references?
cms.dll, businesslogic.dll, umbraco.dll and interfaces.dll
Yes, all are included. The file should be in every Umbraco 7 install if I'm not mistaken. Perhaps you could try it yourself and see if it works. Pretty sure it's not my solution that is the problem though, but the method trying to collect the property.
Also can you try
and see whether it returns the root node of you umbraco?
Yes that should be there in any installations. I did try it and it works fine on mine, thats why I am asking you some obvious questions too see if anything is in its place?
It does return the root node.
Have you tried Cleaning your solution and Republish entire site from Umbraco?
Same results.
Please try so:
Best, Oleg
Gives me the message: There is no current node.
Does it work for you when you place it in Default.cshtml? Wonder what is wrong with my solution, if so.
Yes, it works for me.
I think something wrong with your solution. Please try to re-install it and then try again.
is working on a reply...