Hello,
I have been working with my PagedCollectionView by setting its filter which then changes my data grid on my page. The filter is set by changing values in combo boxes on my form.
PagedCollectionView empListView = new PagedCollectionView(employees);
empListView.Filter = new Predicate<object>(DoFilter);
private bool DoFilter(object o)
{
Employee emp = o as Employee;
If (emp != null)
{
if( cboEmployeeState.Text != “” )
{
if( cboEmployeeTitle.Text != “” )
{
return true;
}
return true;
}
elseif( cboEmployeeTitle.Text != “” )
{
return true;
}
else
{
return false;
}
}
return false;
}
Can i return an answer using the PredicateBuilder that the PageCollectionView can use? I looked in the forums and found this.
Expression<Func<SIGN, bool>> p1, p2, checkP;
if (cboEmployeeState.Text != "")
p1 = p => p.State.Contains("Ohio");
if (cboEmployeeTitle.Text != "")
p2 = p => p.Title.Contains("Manager");
checkP = PredicateBuilder.Or(p1, p2);
But i can not figgure out how to make the PageCollectionFilter use this or if even can be done.
Thanks, for any help,
Craig