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
65
Problem with multiband
posted

Hi,

 I have a webservice that I get some data from, I retrive a custom class (generic list) the class contains a generic list as well that I want to display as a child row:

public
class Foo
{
   private int id;
   private string name;
   private FooSub[ foosubColl;

   public int ID
   {
      get { return iD; }
      set { iD = value; }
   }
   public string Name
   {
       get { return name; }
       set { name = value; }
   }
   public FooSub[ FooSubCollection
   {
     
get { return foosubColl; }
     
set { foosubColl = value; }
   }
}

public class FooSub
{
  
private int id;
  
private string name;
   
  
public int ID
   {
     
get { return iD; }
      set { iD = value; }
   }
  
public string Name
   {
     
get { return name; }
     
set { name = value; }
   }
}

But it just shows up as a cell with the content "FooSub["
What am I missing? The grid is set to ViewStyle.MultiBand

  • 37774
    posted

    I'm pretty sure that in order for the grid to display child data, the property will have to implement either IList or IBindingList, since otherwise it it not able to get enough information to properly handle the object.  You could make your FooSubCollection of type BindingList<FooSub>, which should work.

    -Matt