Filtering

Posts   
 
    
Posts: 54
Joined: 22-Jun-2010
# Posted on: 26-Jul-2010 17:16:05   

Hi, I am working on windows search form with datagridview. I have no problem in populating the grid. for which i have written code as below

private void PopulateGrid() { var datasourceprofession = new EntityCollection<ProfessionEntity>(new ProfessionEntityFactory()); var bucketprofession = new RelationPredicateBucket();

        using (var professionadapter = new DataAccessAdapter())
        {
            bucketprofession.PredicateExpression.Add(ProfessionFields.Flag == StandardFlag.recordvalidflag);

            professionadapter.FetchEntityCollection(datasourceprofession, bucketprofession, 0,
                                                    new SortExpression(ProfessionFields.Description |
                                                                       SortOperator.Ascending));
            dgridprofession.DataSource = datasourceprofession;
        }
    }

Problem is, I have a text box where in user can enter search text and grid should get filtered based on search text. Do i have rewrite fresh query again in text change event go filter the grid or is there a alternate way of doing it

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 27-Jul-2010 05:03:02   

You should write a function that receives the string to search and then use it in your predicateExpression. You can call such function either in the ButtonSearch_Click or wherever you want to trigger the search wink

David Elizondo | LLBLGen Support Team