Reputation: 402
My DevExpress.XtraEditors.LookUpEdit control is not working
I Fill the combo with this code:
void FillCombo()
{
cboStep.Properties.DataSource = ProceduresDALC.Fill_StepDetail(" Where StepID = "+_StepID);
cboStep.Properties.DisplayMember = "Description";
cboStep.Properties.ValueMember = "StepID";
cboStep.Properties.Columns.Clear();
cboStep.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("Description", "Step Detail"));
}
The values are loaded into LookUpEdit
But when I choose a value from the LookUpEdit it gives me the first value only instead of my preferred value.
Upvotes: 1
Views: 1128
Reputation: 66
Just make sure that StepID is a primary key here. If it isnt a primary key then it will give you the first value on change index event
Upvotes: 5
Reputation: 17850
Your code works correctly to me with my datasource:
void FillLookUp() {
lookUpEdit1.Properties.DataSource = new List<StepDetails>{
new StepDetails(){ StepID = 0, Description = "Step1" },
new StepDetails(){ StepID = 1, Description = "Step2" },
new StepDetails(){ StepID = 2, Description = "Step3" },
};
lookUpEdit1.Properties.DisplayMember = "Description";
lookUpEdit1.Properties.ValueMember = "StepID";
lookUpEdit1.Properties.Columns.Clear();
lookUpEdit1.Properties.Columns.Add(new LookUpColumnInfo("Description", "Step Detail"));
}
It seems that some problems with retrieving data from your database cause this issue. So, I suggest you contact the DevExpress Support for further research.
Upvotes: 0