This var items = Model.Parent.Children.Where("customerNo == \"" + profile.Customer_Code + "\""); works in Razor script, but I wish the same code into usercontrol codebehind.
So I'm going to try this:
dynamic model = new umbraco.MacroEngines.DynamicNode(umbraco.NodeFactory.Node.GetCurrent());
var items = model.Parent.Children.Where("customerNo == \"" + profile.Customer_Code + "\"");
Model type in c#...How declare?
How declare Model or use Model var in c# ( usercontrol )?
Thanks
Hi Biagio.
You can use :
var currentNode = Node.GetCurrent();
add this to top :
using umbraco.NodeFactory;
You can do it like this:
Here you can find some more info: http://our.umbraco.org/forum/developers/razor/27417-Use-Razor-code-in-UserControl?p=1#comment102639
Jeroen
Hi, thanks for your help.
This var items = Model.Parent.Children.Where("customerNo == \"" + profile.Customer_Code + "\""); works in Razor script, but I wish the same code into usercontrol codebehind.
So I'm going to try this:
If it works in Razor that code should also work in the code behind of a UserControl :).
Jeroen
The problem was to code the @Model variable into codebehind...
is working on a reply...