Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Pete 213 posts 285 karma points
    Oct 28, 2012 @ 17:10
    Pete
    0

    Razor Where Contains Multiple Operators?

    How do you do multiple operators on the Where command whilst passing parameters/variables?

    This does'nt seem to work...

    foreach(var node in Model.AncestorOrSelf().Descendants("Standard").Where("Name.Contains(@0)", searchString || "bodyText.Contains(@0)", searchString ||))
      {
        <p>@node.Name</p>
      }
  • Pete 213 posts 285 karma points
    Oct 28, 2012 @ 17:55
    Pete
    0

    Struth that was hard work...

    foreach(var node in Model.AncestorOrSelf().Descendants("Standard").Where("Name.Contains(@0) || bodyText.Contains(@0)", searchString))
      {
        <p>@node.Name</p>
      }

    Think i'll write a proper Razor cheat sheet soon!

Please Sign in or register to post replies

Write your reply to:

Draft