Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Ok so I have a quick question.
I will keep it brief incase it's simple :)
Why does this work...
.Where("categorySelector.ToString().Contains(\"1096\")")
and this doesnt...
@{string AVariable ="1096";}
.Where("categorySelector.ToString().Contains(AVariable)")
I have tried...
.Where("categorySelector.ToString().Contains(@AVariable)")
.Where("categorySelector.ToString().Contains(\"AVariable"\)")
.Where("categorySelector.ToString().Contains('AVariable')")
For context the full statement is this
@foreach (var page in progNode.Children.Where("visible").Where("documentTypeAlias == \"Programme\"").Where("categorySelector.ToString().Contains(\"1096\")").OrderBy("createDate desc")) {
Thanks :)
Hi Doogie,
You need to pass in the variable as a parameter, e.g
@{string AVariable ="1096";} .Where("categorySelector.ToString().Contains(@0)",AVariable)
Jeavon
Thanks for your help Jeavon it worked perfectly. :)
You're welcome :-)
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Help with syntax in contains element.
Ok so I have a quick question.
I will keep it brief incase it's simple :)
Why does this work...
.Where("categorySelector.ToString().Contains(\"1096\")")
and this doesnt...
@{string AVariable ="1096";}
.Where("categorySelector.ToString().Contains(AVariable)")
I have tried...
.Where("categorySelector.ToString().Contains(@AVariable)")
.Where("categorySelector.ToString().Contains(\"AVariable"\)")
.Where("categorySelector.ToString().Contains('AVariable')")
For context the full statement is this
@foreach (var page in progNode.Children.Where("visible").Where("documentTypeAlias == \"Programme\"").Where("categorySelector.ToString().Contains(\"1096\")").OrderBy("createDate desc")) {
Thanks :)
Hi Doogie,
You need to pass in the variable as a parameter, e.g
Jeavon
Thanks for your help Jeavon it worked perfectly. :)
You're welcome :-)
is working on a reply...