I'm trying to populate a repeater with results based on specific check boxes being checked.
Table:
SearchTable
----
TableId - int(pk)
Name - varchar
Description - varchar
Active - bool
IsCheck1 - bool
IsCheck2 - bool
Function:
protected void btnCSumit_Click(object sender, EventArgs e)
{
var query = _db.SearchTable.Where(x => x.Active);
if(ckbOne.Checked)
query = query.Where(x => x.isCheck1);
if(ckbTwo.Checked)
query = query.Where(x => x.isCheck2);
query = query.OrderBy(c => c.Name);
repResults.DataSource = query;
repResults.DataBind();
}
The code works when ckbOne OR ckbTwo is true, but if ckbOne AND ckbTwo is true I need it to do something like this
query = query.Where(x => x.isCheck1 || x.isCheck2);
Edit: hopefully made the question a bit more informative.