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:
@if(@node.aProperty.Contains("Hello World")){// Do Something
}
Kind Regards,
mmmoustache
From the documentation:
@foreach(var iteminModel.Children.Where("bodyText.Contains(\"cat\")")){@item.Name}is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.