views:

22

answers:

0

I have pretty much the same problem as this question http://stackoverflow.com/questions/970741 but in windows forms, can anyone help me solve it? this is my code, so you don't have to check the other question:

public class Material
{
    public virtual int id { get; private set; }
    public virtual string nombre { get; set; }
    public virtual string unidad { get; set; }
    public virtual Categorias Categoria { get; set; }
    public virtual IList<Materiales> Materiales { get; set; }

    public Material()
    {
        Materiales = new List<Materiales>();
    }

    public virtual void AddMateriales(Materiales materiales)
    {
        materiales.Material = this;
        this.Materiales.Add(materiales);
    }
}

as you can see I have an object within the IList so when I use the List as the data source for a datagridview I get a object.categoria where I want to get the Categoria.Name property, can anyone help me?. Thanks