Hi,
I am trying to create a generic handler for collections that use the Sort and FindMatches methods. Currently I pass in the Filter, EntityCollection and FieldIndex. I'm having trouble passing the EntityCollection. The idea is to use user entered text to alter the page and select indexes of the datagrid, effectively jumping to a selected page where the text matches. Here is the code
public static void performSearch( GridView theGridView,
DetailsView theDetailsView,
PredicateExpression Filter,
EntityCollection<> theEntityCollection,
int sortField )
{
theEntityCollection.Sort(sortField, System.ComponentModel.ListSortDirection.Ascending);
List<int> matchingIndexes = theEntityCollection.FindMatches(Filter);
if (matchingIndexes.Count > 0)
{
theGridView.PageIndex = (matchingIndexes[0] > 0) ? (matchingIndexes[0] / theGridView.PageSize) : 0;
theGridView.SelectedIndex = matchingIndexes[0] % theGridView.PageSize;
}
}