Aximili
Aximili

Reputation: 29444

Umbraco/Razor: Select where certain property ends with some string

In Razor, how do you select nodes where the NodeTypeAlias ends with Page?

This is a working example

var items = node.Children.Where("Visible").Where("NodeTypeAlias == \"TextPage\"");

but how do you do something like this

var items = node.Children.Where("Visible").Where(NodeTypeAlias.EndsWith("Page"));

Upvotes: 1

Views: 1737

Answers (1)

Aximili
Aximili

Reputation: 29444

I got the answer. Hope it helps someone.

var items = node.Children.Where("Visible && NodeTypeAlias.EndsWith(\"Page\")");

Upvotes: 1

Related Questions