I have a problem that is hard to explain. Essentially, I have a list of a specific class that we can call MyObj. One of the properties of this object is its own list. I would like to bind this list to dataGridView and get this specific property, which also appears in the list. Any ideas? Am I clear enough? :-P ..
Here is an idea. I have my own custom list object overriding the ToString () method:
public class CategoriesList : List<Category> { public override string ToString() {...} }
This is used as a property in the object, for example:
public MyObj { public string Property1 {get; set; } public string Property2 {get; set; } public CategoriesList Categories {get; set; } }
In turn, I have a list of these objects, for example:
List<MyObj> myDataSouce = SomeRepository.GetMyObjList();
Where I bind this to a datagrid view:
MyDataGridView.DataSource = myDataSource;
Property1 and Property2 are automatically generated. Is there a way to add a CategoriesList property? Earlier, I thought that overriding the ToString () method for the class would be enough.
I really got lost on this, since I have no idea how even google for it: -P
source share