title: KnockoutMVC Foreach Lambda filter (or any filter)
body: <p>I have been able to create a display that loops a list of pages.  This will display all pages in the DB table like the following.</p>
  
  <pre><code>@using (var page = ko.Foreach(m =&gt; m.PageList))
  {
      @page.Html.TextBox(p =&gt; p.PageErrorMessage)
      @page.Html.TextBox(p =&gt; p.PageSuccessMessage)
      @page.Html.TextBox(p =&gt; p.Title)
      @page.Html.TextBox(p =&gt; p.Content)
  }
  </code></pre>
  
  <p>I am would like to be able to filter what displays by a lambda expression on the Foreach.  Currently that returns the type IEnumerable, even with a ToList() at the end the following does not work.</p>
  
  <pre><code>//Note: I have tried .Where pl.Title == "string" with the same results
  @using (var page = ko.Foreach(m =&gt; m.PageList.Where(pl =&gt; pl.Title.Contains("Page01")))
  {
      @page.Html.TextBox(p =&gt; p.PageErrorMessage)
      @page.Html.TextBox(p =&gt; p.PageSuccessMessage)
      @page.Html.TextBox(p =&gt; p.Title)
      @page.Html.TextBox(p =&gt; p.Content)
  }
  </code></pre>
  
  <p>I can get the results that I want, but it seems cumbersome to do this.  If I add a visible check to each field with the same check I only see the fields I want.</p>
  
  <pre><code>//Note: p.Title.Contains("string") does not work for me in the Visible here
  @using (var page = ko.Foreach(m =&gt; m.PageList))
  {
      @page.Html.TextBox(p =&gt; p.PageErrorMessage).Visible(p =&gt; p.Title == "Page01!")
      @page.Html.TextBox(p =&gt; p.PageSuccessMessage).Visible(p =&gt; p.Title == "Page01!")
      @page.Html.TextBox(p =&gt; p.Title).Visible(p =&gt; p.Title == "Page01!")
      @page.Html.TextBox(p =&gt; p.Content).Visible(p =&gt; p.Title == "Page01!")
  }
  </code></pre>
  
  <p>Is there a better way to work with foreach to filter down the list or is this currently designed to always return the full set?</p>