combobox that is bound to a emtityCollection doesn't let me select

Posts   
 
    
yogiberr
User
Posts: 432
Joined: 29-Jun-2005
# Posted on: 23-Apr-2006 17:37:13   

version 1.0.2005.1 final (self-servicing) VS2005 winforms


hiya,

the combobox successfully lets me display all the options. However, when I try to select one, the selection reverts to the first item in the list.

It's a strange one.Any ideas?

yogi:

  TblReturnProductConditionCollection returnProductConditionCollection = new TblReturnProductConditionCollection();
            returnProductConditionCollection.GetMulti(null);
            cboReturnProductCondition.DataSource = returnProductConditionCollection;

            IPredicateExpression filtReturnProductCondition = new PredicateExpression();
            filtReturnProductCondition.Add(PredicateFactory.CompareValue(TblReturnProductsFieldIndex.ReturnProductCondtionId, ComparisonOperator.Equal, (int)cboReturnProductCondition.SelectedValue));
            filtReturnProductCondition.Add(PredicateFactory.CompareValue(TblReturnProductsFieldIndex.ReturnId, ComparisonOperator.Equal, _selectedReturnId));
            
sparmar2000 avatar
Posts: 341
Joined: 30-Nov-2003
# Posted on: 23-Apr-2006 18:01:33   

Hi Yogi Do you assign DisplayMember and ValueMember?

Please have a look at http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=5951&HighLight=1 as an example.

yogiberr
User
Posts: 432
Joined: 29-Jun-2005
# Posted on: 23-Apr-2006 18:12:53   

hiya,

yes, I correctly assign both displaymemeber and valuemember. I know this becasue if I change the disply member to an incorrect value, then the combobox simply displays:

myProject.EntityClasses.TblReturnProductConditionEntity

Hmm, I wonder what could be casuing this?

cheers,

yogi

JimHugh
User
Posts: 191
Joined: 16-Nov-2005
# Posted on: 23-Apr-2006 18:39:52   

Is there any chance that the value in the bound entity field is not present in the combobox datasource list of values? Maybe a value that was entered manually?

yogiberr
User
Posts: 432
Joined: 29-Jun-2005
# Posted on: 23-Apr-2006 19:32:37   

oh dear.

In the cboReturnProductCondition_SelectedIndexChanged eventhandler, I was rebinding to the original datasource.

So, obviously it will default to the first entity in the list.

there's no accounting for stupidity flushed

cheers,

yogi