@Html.Action("Index", "laidSpecialOffersSurface", new { vHomeNodeId });
In the controller, I create the node and then try to access its grandchild with:
public ActionResult Index(int vHomeNodeId)
{
var vHomeNode = new Node(vHomeNodeId);
foreach (var vLevel3 in vHomeNode.Children)
{
foreach (var vLevel4 in vLevel3.Children)
But intellisense gives an error with vLevel3.Children saying "object does not contain a definition for Children....".
Although this probably won't solve your problem, one thing to keep in mind is that Node is obsolete. If you are using umbraco 6+, you probably want to do something like Umbraco.TypedContent(vHomeNodeId); You will get back an IPublishedContent object. That's the way to go.
I think what you really have going on here is a typing issue. Basically by using var for the variable type in each of your foreach statements the system can't really figure out what it's working with. You can try just changing the vars to Node and be a little more explicit with your typing.
I think you should probably follow Mark's suggestion and switch to TypedContent.
Get node from Id in a controller
I'm passing a node ID from a macro with:
In the controller, I create the node and then try to access its grandchild with:
But intellisense gives an error with vLevel3.Children saying "object does not contain a definition for Children....".
What am I doing wrong.
Your help would be much appreciated.
Thanking you in anticipation.
Roger
Although this probably won't solve your problem, one thing to keep in mind is that Node is obsolete. If you are using umbraco 6+, you probably want to do something like
Umbraco.TypedContent(vHomeNodeId);
You will get back an IPublishedContent object. That's the way to go.I think what you really have going on here is a typing issue. Basically by using var for the variable type in each of your foreach statements the system can't really figure out what it's working with. You can try just changing the vars to Node and be a little more explicit with your typing.
I think you should probably follow Mark's suggestion and switch to TypedContent.
Thanks for your replies.
I fixed the problem by using:
Roger
is working on a reply...