Testalert.cshtml(14): error CS1061: 'umbraco.MacroEngines.DynamicNode' does not contain a definition for 'GetPropertyValue' and no extension method 'GetPropertyValue' accepting a first argument of type 'umbraco.MacroEngines.DynamicNode' could be found (are you missing a using directive or an assembly reference?)
Well, it is sort of embarrassing :) Earlier on, I made a Response.Write to output the value of the variable Projects, to the screen, but in the latest version it just spits out an e-mail, and no output on the screen.
It seems though, I cannot use the GetPropertyValue(var) in this version of Umbraco, but only GetProperty(var).Value.
Numeric selection
I am trying to get all the pages with two numeric properties, where the one is greater than the other, like this:
var Node = @Model.NodeById(1157);
foreach (var page in Node.Children.Where("Visible").Where("maal.AsInt() > opnaaet.AsInt()"))
I does not return any result though, even though maal has a value of 100000 and opnaaet has a value of 2000. If I change the selection to:
foreach (var page in Node.Children.Where("Visible").Where("maal.AsInt() > 2000"))
I get the results needed, but it is not an option to make the selection like this.
What am I doing wrong?
It is probably because you where statement cannot get parsed by the engine.
You are using the dynamic object Model. Try using the strongly typed DynamicNode
Like this :
Dave
Well, it just gives me an error like:
umbraco.MacroEngines.DynamicNode' does not contain a definition for 'GetPropertyValue'
Did you have the @using and @inherits directives in your macro cshtml script ?
Yes, I have:
Try putting the inherits as last
What version of Umbraco are you using ?
Well, no change :(
I'm using version 4.7.0
Can you post your entire code ?
Yes, of course:
Can you try this :
I have tried it, but still same error:
Testalert.cshtml(14): error CS1061: 'umbraco.MacroEngines.DynamicNode' does not contain a definition for 'GetPropertyValue' and no extension method 'GetPropertyValue' accepting a first argument of type 'umbraco.MacroEngines.DynamicNode' could be found (are you missing a using directive or an assembly reference?)
one more try :
Still same error, but related to the following line:
Update: Sorry, my mistake - it seems it is still the following line which causes the error:
Change @page to page.
No change :(
Maybe it's the AsInt() function causing the problem ? Can you remove that and use a normal cast to int ?
Do you mean like Convert.ToInt32(var)?
Yep
Does not change the outcome. If I change it like this:
I don't get any errors, but no usefull output either.
It seems to be working now. I get emails as I should.
Thank you very much for your help, Dave
What did you change to get it working ?
Well, it is sort of embarrassing :) Earlier on, I made a Response.Write to output the value of the variable Projects, to the screen, but in the latest version it just spits out an e-mail, and no output on the screen.
It seems though, I cannot use the GetPropertyValue(var) in this version of Umbraco, but only GetProperty(var).Value.
Glad you worked it out
Not without your help :) Thanks
It's me again :)
The DynamicNode still puzzles me. If I want to select all nodes with the property slutdato equal to yesterdays date, I get this error:
System.NullReferenceException: Object reference not set to an instance of an object
When trying to do the following:
Does your date property have a value ?
Dave
Yes, it does. It is a Datepicker-property.
Well, I've got it solved - damn case-sensitive coding :)
is working on a reply...