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
219
WinGrid binding question...
posted

I am working on an project that was originally developed using VS 2003 and the .Net Framework 1.1, and Infragistics Windows Forms controls that target CLR 1.0.  We are also using Rocky Lhotka's CLSA framework.  In this project, our collection objects derive from base classes in the CSLA framework that implement the IBindingList interface and set AllowNew = true.  One of these objects was bound to an Infragistics WinGrid control and allowed adding, deleting new rows, etc.  Everything has always worked as it should.

Recently, however, we upgraded to VS 2008 and began compiling our project against .Net Framework 2.0 and using Infragistics controls that target CLR 2.0.  We are still using the same version of CSLA, though we now compile it against .Net Framework 2.0.  Everything in the upgraded application seems to work fine, except the collection that is bound to the WinGrid control.

For some reason, anytime the user tries to add rows to the collection from within the WinGrid, the grid throws a System.NotSupportedException, saying that "The list must be an IBindingList to AddNew."    However, my bound collection object definitely DOES derive from a base class that implements IBindingList, just as it did in the earlier version.  None of this code has changed from the earlier version.  The only thing that has changed is the version of WinGrid that we are using (targeting CLR 2.0 instead of 1.0).

I built a test application in which I have been unable to reproduce the problem.  The test app works fine.  I have also searched the forum here, but I have not been able to find anything that has been helpful.

I was wondering if anyone might be able to think of anything at all that I might be overlooking that would cause a WinGrid (version 2008-3) control to throw this exception even when bound to a collection that DOES implement IBindingList.  I have been working on this problem for quite a while and have been unable to identify the issue.  Any thoughts would really be appreciated.

Thanks!!!!

Parents
No Data
Reply
  • 469350
    Suggested Answer
    Offline posted

    I can't see why anything in the grid would cause that error. The grid simply checks the type of the list returned by the BindingManager to see if it's an IBindingList. So it must be getting a list that does not implement IBindingList from somewhere.

    One thing you might try, in order to get around this, is to wrap your data source in a BindingSource instead of binding it directly to the grid. Microsoft made some changes to the BindingManager in CLR2 that can cause problems if you do not use a BindingSource.

Children