I've created a function to toggle on/off ('visPrisliste') content pulled from a parent node ('Sprog'), but the content is shown regardless if there's a selection in the true/false selection type I've made for it.
I've probably made a mistake in the Razor script, so if you can spot the error, please point it out to me.
@{ var langNode = Model.AncestorOrSelf("Sprog"); }
The 'visPrisliste" property is in fact a True/False datatype. I'm kind of new to Razor, so what influence does this have? Should I pick something else as a datatype?
The code itself looks perfect - the only thing that can be wrong is the value that the property returns. I would try just to return its value itself - for instance simply to insert a string of code like
<div> @Model.visPrisliste </div>
somewhere outside that "@if" and inspect what value it outputs than.
I've tried what you suggest, and nothing appears to show up after saving and reloading the page.
I'm starting to think this is tied to another issue with the site, one where each change to the site has to be refreshed through a recycle of the app pool on the server. However, usually after such a recycle the changes normally show up, whereas now they don't - at least certain cshtml document changes doesn't. The site is acting very peculiar.
Hi, Daniel. It's rather strange at all that you need to recycle your pool after every change. Perhaps a real problem is here and not in your macro. I looks like your changes go to database smoothly but than for some reason aren't picked up by xml cache. Have you looked into the log for some errors happening after saving?
items displaying regardless of option picked
I've created a function to toggle on/off ('visPrisliste') content pulled from a parent node ('Sprog'), but the content is shown regardless if there's a selection in the true/false selection type I've made for it.
I've probably made a mistake in the Razor script, so if you can spot the error, please point it out to me.
Hi. What's the datatype of the "visPriselist" property? You could try to add something like:
to the top of your macro to validate that it really returns a boolean value as it's expected.
I suspect that for some reason it returns in fact a string like "true/false".
The 'visPrisliste" property is in fact a True/False datatype. I'm kind of new to Razor, so what influence does this have? Should I pick something else as a datatype?
It should return a bool in such a case. Though I'm not sure for all versions of umbraco. What version do you use?
The code itself looks perfect - the only thing that can be wrong is the value that the property returns. I would try just to return its value itself - for instance simply to insert a string of code like
somewhere outside that "@if" and inspect what value it outputs than.
I've tried what you suggest, and nothing appears to show up after saving and reloading the page.
I'm starting to think this is tied to another issue with the site, one where each change to the site has to be refreshed through a recycle of the app pool on the server. However, usually after such a recycle the changes normally show up, whereas now they don't - at least certain cshtml document changes doesn't. The site is acting very peculiar.
I've tried to republish everything and refresh the app pool without no effect. It appears that the cshtml file is saved (by verifying through ftp) but no effect is apperant at the website. I posted about it here: http://our.umbraco.org/forum/getting-started/installing-umbraco/29189-Recycling-app-pool-each-time-a-change-has-been-made-to-
The umbraco install is version "umbraco v 4.7.1 (Assembly version: 1.0.4281.20201)"
Could these two issues be related?
Hi, Daniel. It's rather strange at all that you need to recycle your pool after every change. Perhaps a real problem is here and not in your macro. I looks like your changes go to database smoothly but than for some reason aren't picked up by xml cache. Have you looked into the log for some errors happening after saving?
is working on a reply...