Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2077
Adding new grid rows with data binding to a business object which is instantiated by a helper class
posted

I am binding a WinGrid to a IList<BusinessObjects>. My business object is a little bit special, and to instantiate it I am using a helper class, to be able to create the object I need in different use cases.

In this case I have to create 2 different instances of the same business object based on the use case. The properties bound to the grid's columns have an underlying object that has to be instantiated before any values can be set to the field, and this is exactly what the helper class is doing.

I added an AddNewRow as the last row in the grid.  What I need is to control the way the new object is added to the list, because the one instantiated by default, using the new keyword, doesn't work for me, because it has all the underlying objects set to null.

 Is there any way to do this?

 Emanuel

Parents
  • 469350
    Verified Answer
    Offline posted

    Hi Emanuel, 

        The grid just calls AddNew on the BindingManager. There's no way to change that. You would have to update your business object. Maybe you need to implement IBindingList instead of IList.  

Reply Children
No Data