title: LinqDataSource: Filtering and binding to gridview
body: <p><strong>the problem is not solved the way i wanted but i go ahead give the credit to : ŁukaszW.pl for his time and effort.</strong></p>
  
  <p>i am using gridview control and a linqdatasource and its all working fine and i have added the functionlity of searchingBySubject and i added WhereParameters and than binding my gridview (see the code below) but somehow its not returning any rows and i see i have number of rows based on what i am searching.</p>
  
  <pre><code> protected void btnSearch_Click(object sender, EventArgs e)
   {    
     this.LinqDataSource1.WhereParameters["Subject"].DefaultValue = this.txtSubject.Text;
     this.GridView1.DataBind();
   }
  
  &lt;asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"  
           DataSourceID="LinqDataSource1"  
          EmptyDataText="There are no data records to display."&gt; 
          &lt;Columns&gt; 
              &lt;asp:BoundField DataField="UserID" HeaderText="UserID" ReadOnly="True"  
                  SortExpression="UserID" /&gt; 
              &lt;asp:BoundField DataField="Username" HeaderText="Username"  
                  SortExpression="Username" /&gt; 
              &lt;asp:BoundField DataField="FirstName" HeaderText="FirstName"  
                  SortExpression="FirstName" /&gt; 
              &lt;asp:BoundField DataField="LastName" HeaderText="LastName"  
                  SortExpression="LastName" /&gt; 
              &lt;asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" /&gt; 
          &lt;/Columns&gt; 
      &lt;/asp:GridView&gt; 
  
       &lt;asp:LinqDataSource ID="LinqDataSource1" runat="server"  
          ContextTypeName="MyDataContextDataContext" 
          onselecting="LinqDataSource_Selecting" &gt; 
              &lt;WhereParameters&gt; 
                 &lt;asp:Parameter Name="Subject" /&gt;
              &lt;/WhereParameters&gt; 
          &lt;/asp:LinqDataSource&gt;
  
  
  
  public List&lt;Reporter&gt; GetInquiries()
          {
              using (MyDataContextDataContext dc = conn.GetContext())
              {
                  var loadAll = (from spName in dc.spReporter()
                                 select spName);
  
                  List&lt;Reporter&gt; reporterList = new List&lt;Reporter&gt;();
  
                  foreach (var item in loadAll)
                  {
                      reporterList.Add(new Reporter(item.Id, item.InqDate, item.Subject));
                  }                
  
                  return reporterList;
              }      
  </code></pre>
  
  <p><strong>ERROR:</strong>  </p>
  
  <pre><code> The query results cannot be enumerated more than once
  </code></pre>