title: How to filter a Sharepoint:ListView
body: <p>In VS2010 I have a SharePoint 2010 project with an Application Page. In this simple page I have header information about an order and a <strong>SharePoint:ListView</strong> for the product detail. So, I just want to filter that ListView by OrderId:</p>
  
  <pre><code>SPWeb myWeb = SPControl.GetContextWeb(Context);
  SPList lstOrderDetail = myWeb.Lists["OrderDetail"];
  SPView vwOrderDetail = lstProductosPedidos.Views["ShortedForCustomer"];
  lvOrderDetail.ListId = lstOrderDetail.ID.ToString("B").ToUpperInvariant();
  lvOrderDetail.ViewId = vwOrderDetail.ID.ToString("B").ToUpperInvariant();
  lvOrderDetail.DataBind();
  </code></pre>
  
  <p>This code show a list with all the items in the "OrderDetail" list.</p>
  
  <p>I tried to do with an SPQuery, but I don't know how to associate the SPListItemCollection (the result of the query) to the SharePoint:ListView.</p>
  
  <pre><code>SPQuery qryOrderDetail = new SPQuery(vwOrderDetail);
  qryOrderDetail.Query = string.Format(@"
    &lt;Where&gt;
      &lt;Eq&gt;
        &lt;FieldRef Name='OrderId' LookupID='True'/&gt;
        &lt;Value Type='Number'&gt;{0}&lt;/Value&gt;
      &lt;/Eq&gt;
    &lt;/Where&gt;", iOrderID);
  SPListItemCollection lstOrderDetailFiltered = lstProductosPedidos.GetItems(qryOrderDetail);
  </code></pre>
  
  <p>How can I filter a SharePoint:ListView with the result of a SPQuery? I am using incorrect components?</p>
  
  <p>Thanks in advance...</p>