OK first time I feel I have had to post, lots of information out there on datagrids but nothing explains what I need in a way I understand.
dataBooks.DataSource = null;
dataBooks.AutoGenerateColumns = true;
dataBooks.DataSource = _Author.Books.ToList();
This returns a list of objects, however I want to add another column in which I can call getType() which will return the book format.
I do not know how to bind data when I change autogeneratecolumns to false so I get a list of blanks. Be gentle, it maybe obvious to you but I am a newbie.
I would like to call a method GetBookType() which will return a string.
public abstract partial class Book
{
public Book()
{
this.Orders = new HashSet<Order>();
}
public string AuthorName { get; set; }
public string Title { get; set; }
public double Price { get; set; }
public int Quantity { get; set; }
public int Year { get; set; }
public virtual Author Author { get; set; }
public virtual ICollection<Order> Orders { get; set; }
}
And the partial class which will return a string of type
public abstract partial class clsBook { public override string ToString() { return this.Title + "\t" + this.Year + "\t" + this.Price + "\t" + this.Quantity + "\t" + this.GetType(); }
public abstract void EditDetails();
public abstract string GetBookType();