Sort not working

Posts   
 
    
daz_oldham avatar
daz_oldham
User
Posts: 62
Joined: 20-Jul-2007
# Posted on: 28-Sep-2007 17:48:10   

I'm trying to bind a listbox, which is working fine, as is the filter.

However, when I try to add the sort clause in, it isn't working - any ideas as to why?

Many thanks

Darren

PredicateExpression filter = new PredicateExpression();
            filter.Add(ManufacturerFields.CatalogueId == m_iCatalogueID);

            SortExpression sort = new SortExpression();
            SortClause clause = new SortClause(ManufacturerFields.Name, SortOperator.Ascending);

            ManufacturerCollection manufacturers = new ManufacturerCollection();

            LLBLGenProDataSource dsManuf = new LLBLGenProDataSource();
            dsManuf.CacheLocation = DataSourceCacheLocation.Session;
            dsManuf.DataContainerType = DataSourceDataContainerType.EntityCollection;
            dsManuf.FilterToUse = filter;
            dsManuf.SorterToUse = sort;
            dsManuf.EntityCollection = manufacturers;
            dsManuf.EntityCollectionTypeName = "RedStarEnergy.DAL.CollectionClasses.ManufacturerCollection";
            lstManufacturer.DataSource = dsManuf;
            lstManufacturer.DataValueField = "ManufacturerID";
            lstManufacturer.DataTextField = "Name";
            lstManufacturer.DataBind();
daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 29-Sep-2007 05:36:36   

Hi Darren, I think you should add the SortClause to the SortExpression clauses collection.

SortExpression sort = new SortExpression();
SortClause clause = new SortClause(ManufacturerFields.Name, SortOperator.Ascending);

// line missing
sort.Add(clause);

Cheers

David Elizondo | LLBLGen Support Team
daz_oldham avatar
daz_oldham
User
Posts: 62
Joined: 20-Jul-2007
# Posted on: 29-Sep-2007 11:55:11   

daelmo - thank you for not laughing me off the forum!

best regards

darren