title: Filtering a list based on dropdown value equaling database column value
body: <p>I have an MVC web page using C# and Razor syntax which is displaying a list of results brought back from the database and I want to filter the results with a dropdown menu.</p>
  
  <p>Basically I want to only show the results which has a column value that equals the value of the dropdown menu. My only problem is that the column is a BIT data type and I just can't get it to work.</p>
  
  <p>I've tried converting the value of the dropdown to bool but this doesn't work either. I'm not at work right now so can't post any code sorry.</p>
  
  <p>The way I initially query the database is using a search string and basically comparing the different columns to the search string and also whether the search string = "" or is null. I have just tacked the dropdown menu query on to the end of this search string select query as it seems the only place it could go and it is something like this - </p>
  
  <pre><code>from db(db.Name.Contains(searchString) &amp;&amp; db.InUse.Equals(dropdownValue))
  select db
  </code></pre>
  
  <p>I know that's not exactly right but you hopefully get the idea. And just to clarify, it's the InUse.Equals that I'm having trouble with as InUse is a BIT data type and dropdownValue is an INT and doesn't even work when converted to BOOL. I get no errors and the page loads but it doesn't actually filter the results.</p>
  
  <p>Any help would be great and I'll try update the post tomorrow with actual code.</p>