Is it possible to use .Contains on an IF statement?
Hi Everyone,
The title is pretty transparent, but I was just wondering if it's possible to run an if statement to check if a node property contains a certain value or phrase. I know of .Contains() as part of a foreach loop but is there an equivalent for an if statement? Something like this:
@if(@node.aProperty.Contains("Hello World")){ // Do Something }
Is it possible to use .Contains on an IF statement?
Hi Everyone,
The title is pretty transparent, but I was just wondering if it's possible to run an if statement to check if a node property contains a certain value or phrase. I know of .Contains() as part of a foreach loop but is there an equivalent for an if statement? Something like this:
Kind Regards,
mmmoustache
From the documentation:
@
foreach
(var item
in
Model.Children.Where(
"bodyText.Contains(\"cat\")"
))
{
@item.Name
}
is working on a reply...