DataGridView: databinding to BindingList should get bound values from T

0
0

Hi Wisej people,

I have this DataGridView that is bound to a BindingSource

this.dataGridView.DataSource = this.employeeListBindingSource;

The DataSource of this BindingSource is a BindingList<Employee>

this.employeeListBindingSource.DataSource = typeof(BusinessObjects.EmployeeList);

public class EmployeeList : BindingList<Employee> {}

The attached sample includes a common business class and 2 UI projects, for Windows Forms and for Wisej.

I have an object numbering system that works correctly on Windows Forms (and WPF and whatever) but fails under Wisej.

 

The Windows Forms DGV instantiates a new Employee every time I move to  a different (new) row. This means it tries to get bound values from the new BO. Of course it sets user entered values on the BO without any issue.

The Wisej DGV only instantiates a new Employee whenever I quit the (old) row. So it doesn’t try to get bound values for the new row but only tries to set user entered values on the BO.

 

I don’t think one should use DefaultValuesNeeded when using data binding.

Please help. Is there some option I should use or is it a plain old bug?

  • You must to post comments
0
0

Hi Luca,

I remember reading something about Wisej optimizing the communication but I didn’t think this feature (it’s a feature indeed) was the reason for this behaviour. I browsed all DGV’s properties and methods looking for some option like DataBindingNeedDefaults or  DataBindingLoadDefaults. So I guess there will be some option to change this behaviour. Nice to know.

  • You must to post comments
0
0

Hi Tiago,

This “feature” is by design. Winforms creates and destroys the new automatic row every time it gains/loses the focus. Since Wisej has to also try to optimize the communication between the client grid and the server data model, it creates the new row once when the edited values are committed.

However, I see your point and I think we can use the default values of the BO. Will log and hopefully fix quickly.

Best,

Luca

 

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.