I have the following (sample)code to filter search results from a LLBLGen data source:
IPredicateExpression firstFilter = new PredicateExpression();
firstFilter.Add(new FieldLikePredicate(CustomerFields.FirstName, null, txtSearchFirst.Text.Trim() + "%"));
llbldsCustomer.FilterToUser = firstFilter;
llbldsCustomer.DataBind();
gridview1.DataBind();
This works fine and filters the results when I trigger this code. However, if I add a second filter, I have to press invoke the code twice before I see results. Below is the snippet with 2 filters:
IPredicateExpression firstFilter = new PredicateExpression();
firstFilter.Add(new FieldLikePredicate(CustomerFields.FirstName, null, txtSearchFirst.Text.Trim() + "%"));
firstFilter.Add(new FieldLikePredicate(CustomerFields.LastName, null, txtSearchLast.Text.Trim() + "%"));
llbldsCustomer.FilterToUser = firstFilter;
llbldsCustomer.DataBind();
gridview1.DataBind();
The issue is fine for every search after the first one; however, I need it to work on the first one.
UPDATE: The code is located in an ASP.Net Button Click event. There is no code in the Page Load event block that affects this data source either.
Any ideas?