Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hello Sorry for this (easy) question I have been messing around with it for a few hours now and i cant get the property to show..
var Counter = Umbraco.Content(1408);
var num = Counter.accumulatedClicks;
This should Write back the property right ?
what i could do is using CurrentPage.Parent.and then find the proper child but i would like to get this working....
It seemed to work for a few days so im kinda baffeled...
i use @num to get the number out
Now the Number i get is 0 which is wrong so i must be doing somthing wrong...
Looking through the forums yielded no solution
Found the solution
IContent iProp= ApplicationContext.Current.Services.ContentService.GetById(1408);
@iProp.Properties.First(x => x.Alias == "accumulatedClicks").Value
Hi there, there is nothing specifically wrong with this code (the capital C in counter could be lower). Have you tried publishing the node again?
I'm assuming there is some reason you aren't using published content. If that's the case, here's a slightly shorter version of what you posted already:
var service = ApplicationContext.Current.Services.ContentService;
var node = service.GetById(1408);
var value = node.GetValue<int>("accumulatedClicks");
// If the above doesn't work, try this (then cast/convert/parse as necessary):
var valueObject = node.GetValue<object>("accumulatedClicks");
yes the content was/is unpublished..
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted