DevExpress LookupEdit

DevExpress LookupEdit

Old forum URL: forums.lhotka.net/forums/t/2254.aspx


kdlc posted on Thursday, February 01, 2007

How do i bind a NVL to a LookupEdit Control (DevExpress)?

On my InvoiceEdit form i have this:

Public Sub New(ByVal NewInvoice As Invoice)
InitializeComponent()
mInvoice = NewInvoice
LookUpEdit1.DataBindings.Add(
"EditValue", mInvoice, "EmployeeID")
LookUpEdit1.Properties.DataSource = EmployeeList.GetEmployeeList
Me.LookUpEdit1.Properties.DisplayMember = "Name"
Me.LookUpEdit1.Properties.ValueMember = "Id"
ApplyAuthorizationRules()
End Sub

but when i check the value of my mInvoice.EmployeeID prop on the event of the LookupEdit editvaluechanged the mInvoice.employeeID still = 0, am i overlooking something?

Thanks in Advance!

razorkai replied on Thursday, February 01, 2007

Two suggestions.

1).  Change the line LookUpEdit1.DataBindings.Add("EditValue", mInvoice, "EmployeeID") to be

LookUpEdit1.DataBindings.Add("EditValue", mInvoice, "EmployeeID", false, DataSourceUpdateMode.OnPropertyChanged)

Might not make a difference, but that is how I use it.

2)  Check that the datatype of EmployeeID in mInvoice is exactly the same as the datatype of Id in your EmployeeList object.  If they are even slightly different e.g. int and short it will not work. 

Other than that can't see anything wrong.  I use LookUpEdits with NVLs all the time.


HTH

ajj3085 replied on Thursday, February 01, 2007

The other suggestion I would add is to stick a BindingSource component between the LookupEdit and the actual BO collection.. I know this has solved problems in the past.

kdlc replied on Thursday, February 01, 2007

Allright Guys! i got it working using the following code:

'Fill the lookupEdit Control - Employee
LookUpEdit1.Properties.DataSource = EmployeeList.GetEmployeeList
LookUpEdit1.EditValue =
"0"
Me.LookUpEdit1.Properties.DisplayMember = "Name"
Me.LookUpEdit1.Properties.ValueMember = "Id"
'Bind Course.EmployeeID to LookupEdit control - Employee List
LookUpEdit1.DataBindings.Add("EditValue", mInvoice, "EmployeeID", False, DataSourceUpdateMode.OnPropertyChanged)

Also in the control props i didn't set any properties (if anyone its wondering about that) and this code its located on the Public Sub New of the FormEdit.

Thanks for the Help! 

 

cash_pat replied on Thursday, February 01, 2007

Just to pitch in.

If you are using PivotGrid from DevExpress then the ''case'' of your properties in your BO must exactly match to ur DevExpress Pivotgrid fieldnames

I have a spent many a nights trying to figure this bug.

regards

pat cash

Copyright (c) Marimer LLC