Cannot edit values of DataGridView bound to a BindingList
- by m_oLogin
Hello community,
I have trouble editing a databound bindinglist. Let me illustrate it with the following:
Say I have the Person class:
public Class Person{
private string m_firstname;
private string m_lastname;
public string FirstName{get;set;}
public string LastName{get;set;}
public Person{ ... }
}
I then have a containing class called Population:
public class Population{
private BindingList<Person> m_lstPerson = new BindingList<Person>();
private string m_countryName;
public BindingList<Person> ListPerson{get; set;}
public string CountryName { get; set; }
}
I then have on one form a first datagridview with DataSource = m_lstPopulation (BindingList). The binding works like a charm when working with the Population objects. When I double click, it opens up a dialog form showing the object details. One tab in the details holds a datagridview bound to that population's ListPerson.
The second datagridview displays fine. However, I cannot edit or add cells in this datagridview. None of the columns is set to read-only. In fact, both datagridview have just about the same parameters.
What am I missing? It seems that a lock has been placed on the Population object so that its inner fields cannot be edited...
Please advise. Thanks.