I don't clearly understand you. Anyway, you can fetch a TypedList directly from DB passing a IPredicateExpression, so you don't have to do it in-memory (find matches). I post a tiny example here:
public void FillSomeTypedList()
{
// the list
ProductTypedListTypedList productList = new ProductTypedListTypedList();
// the filter
IRelationPredicateBucket filter = BuildTheFilter(productList);
// the results
productList = (ProductTypedListTypedList) FetchResults(productList, filter);
...
}
private IRelationPredicateBucket BuildTheFilter(ITypedListLgp2 list)
{
// fields
IEntityFields2 fields = list.GetFieldsInfo();
/// selected field
/// Here you have to extract the alias name from the combobox
string selectedFieldFromCombo = "CompanyName";
EntityField2 selectedField = (EntityField2) fields[selectedFieldFromCombo];
/// value to search
/// Here you have to extract the value from a TextBox.Text
string searchValue = "Karkki Oy";
object castedValue = Convert.ChangeType(searchValue, selectedField.DataType);
/// build the filter
/// This is the same in all cases. Unless you want to do various comparissions (==, <, >, etc).
IRelationPredicateBucket filter = new RelationPredicateBucket();
filter.PredicateExpression.Add(selectedField == castedValue);
// lets return the filter
return filter;
}
private ITypedListLgp2 FetchResults(ITypedListLgp2 list, IRelationPredicateBucket filter)
{
// fetch the typedList
using (DataAccessAdapter adapter = new DataAccessAdapter())
{
adapter.FetchTypedList(list, filter.PredicateExpression);
}
// return results
return list;
}
I don't get you about the page/offset thing...
cheers