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
I've got this really strange problem and I'm not sure if I'm just being stupid so any help to avoid me hitting myself in the face will be much appreciated! :)
I've got a document type of "Homepage". On this document type, I have added a new property which has the alias of "showcaseSummary". In my Razor code, I want to use the .GetPropertyValue("showcaseSummary") method to retrieve the value set in my content. I have set a value, saved and published my page. When stepping through the Razor, if I look at the node -> PropertiesAsList object, my new property isn't appearing in there. This therefore causes an error when trying to access the property, because as far as my code can see, it doesn't exist. I however know it does!
I have tried deleting, re-adding with a different name (it was showcaseText originally), putting it on a different tab. It's running via Visual Studio but I also tried running it via WebMatrix and had the same problem. I've tried restarting the site, re-building, everything I can think of basically!
Does anyone have any idea why this property is not appearing on my node? I can see every other property, just not the new one I have added!
I can see someone below has had what seems to be the same problem, but the advice there was to publish and I have done that.
What version of Umbraco are you using? If you're using umbraco +4.10 are you then using MVC or webforms? I'm asking since there is a difference in the implementation of Razor whether you're using MVC or webforms.
Looking forward to be hearing from you.
I'm using version 4.11 (I think it's 4.11.2 but I can check that when I'm back in work tomorrow if that makes any difference) and MVC.
Hi, Sarah. I would initially take a glance into the dbo.cmsContentXml database table and the umbraco.config xml file. I have seen before that sometimes it happens that new properties are not properly propagated down there and so remain invisible to the higher-level API (xml or razor e.g.).
Not sure if this helps but here is a snippet of my Razor code. The variable "site" is the node ID for the content node I am currently looking at.
var siteContent = Model.NodeById(site);
var media = Model.MediaById(siteContent.GetPropertyValue("showcaseImage"));
It's having an issue because it can't find the new property "showcaseImage". I use the siteContent variable later to do @siteContent.GetPropertyValue("title") and that works perfectly fine as title was a pre-existing property.
I'm not really getting anywhere with it so far!
Ah thanks Rodion, you posted as I was writing my post! I'll give your suggestion a try now.
Rodion as you suspected the new properties I have added are not present in the XML in the DB table dbo.cmsContentXml. I'm not sure what config file you mean. Can you tell me what folder this is in? I have checked the umbracoSettings.config but I can't see anything in there to do with document types.
Sarah, that's not a config file but the Xml cache of the content (personally I don't like the name a bit since the "*.config" is a bit confusing). Anyway if there're no changes in the dbo.cmsContentXml definitely there would be none of them in the umbraco.config file. I created a very simple package some time ago that adds a couple additional options to the "republish all" dialog. Here is it: http://our.umbraco.org/projects/backoffice-extensions/republishing-enhancement. You could try to use it to rebuild the cmsContentXml table that perhaps might resolve the issue.
That's done the trick Rodion!
Thank you so much. It would have taken me forever to get to that point!
Your link didn't work so I went to the projects and searched for "Republishing Enhancement" but here's the link again to see if this one works...
I have edited this to remove what I wrote as I was being amazingly stupid! Ha ha.
It all works thank to Rodion's package!
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted