CodeSmith Community
Your Code. Your Way. Faster!

TList parent/child databinding

Latest post 01-31-2007 3:22 PM by bgjohnso. 4 replies.
  • 01-29-2007 12:54 PM

    • RCouchman
    • Not Ranked
    • Joined on 02-15-2006
    • Posts 5
    • Points 175

    TList parent/child databinding

    Binding a TList<Orders> that contains OrderDetails to a pair of parent/child DataGridViews isn't working for me.  The parent is ok, but the child grid displays the correct number of rows with the values in the cells all null.  If I use List<> rather than TList<>, the cell values display ok.

     I've attached a small project that shows the problem.  I created a couple DataSources for the grids from Orders and OrderDetails, create a few instances of Orders with OrderDetails manually, put them in a TList/List, and attached the lists to the binding sources.  If someone could take a look and offer suggestions I'd really appreciate it.

    Thanks, Richard

    Filed under:
    • Post Points: 65
  • 01-29-2007 12:57 PM In reply to

    Re: TList parent/child databinding

    Thanks Richard,  we'll take a look at your sample project and get back with you.

     


    Robert Hinojosa
    -------------------------------------
    Member of the Codesmith Tools, .netTiers, teams
    http://www.nettiers.com
    -------------------------------------
    • Post Points: 5
  • 01-29-2007 2:38 PM In reply to

    • bgjohnso
    • Top 10 Contributor
    • Joined on 09-15-2005
    • Spokane, WA
    • Posts 764
    • Points 22,530

    RE: TList parent/child databinding

    Richard,

     

    This has definitely been an issue in the past, as indicated by these couple of threads:

     

    http://community.codesmithtools.com/forums/permalink/15956/15956/ShowThread.aspx#15956

     

    http://community.codesmithtools.com/forums/permalink/19277/19277/ShowThread.aspx#19277

     

    Both threads have proposed solutions.  While each solution is different, they both appear to work.  The simplest is proposed by GRAW, and just requires a simple modification to EntityHelper.GetBindableProperties:

     

    public static PropertyDescriptorCollection GetBindableProperties(Type type)

    {

          // create a filter so we only return the properties that have been designated as bindable

          Attribute[] attrs = new Attribute[] { new System.ComponentModel.BindableAttribute(true) };

     

          if (type.IsGenericType)

          {

             type = type.GetGenericArguments()[0];

          }

     

          // save the bindable properties in a local field

          return TypeDescriptor.GetProperties(type, attrs);

    }

    Give this a shot and see if it fixes your problem until we get the fix in place.

    b e n    j o h n s o n

    Ben Johnson
    ------------------------------
     Member of the .NetTiers team
     Visit http://www.nettiers.com
    ------------------------------

    • Post Points: 35
  • 01-30-2007 7:27 AM In reply to

    • RCouchman
    • Not Ranked
    • Joined on 02-15-2006
    • Posts 5
    • Points 175

    Re: RE: TList parent/child databinding

    Reply |Contact |Answer

    That fixed it.

    Ben, Robert, everyone else - thanks.

    • Post Points: 35
  • 01-31-2007 3:22 PM In reply to

    • bgjohnso
    • Top 10 Contributor
    • Joined on 09-15-2005
    • Spokane, WA
    • Posts 764
    • Points 22,530

    Re: RE: TList parent/child databinding

    This has been added in SVN 471.

    Ben Johnson
    ------------------------------
     Member of the .NetTiers team
     Visit http://www.nettiers.com
    ------------------------------

    • Post Points: 5
Page 1 of 1 (5 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems