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
35
Underlying datasource doesn't support adding new rows
posted

I am working with Entity Framework 4 and currently have a model consisting of many parent child tables. In the current scenario I am using a parent table called Lookups and a child table called LookupValues.

My Grid assignment statement is like:

grid.Datasource = entities.Lookup;

 

This is showing me the Lookups and LookupValues in the heirarchical format. I can even add/edit rows to Lookup band and I can also EDIT rows to the LookupValues (child) band.

However I am getting an error the moment I am clicking on the new row for the child band - "Underlying datasource doesn't support adding new rows".  

Apart from the datasource assignment code as mentioned above, the only other code I have written is:

void ctlGrid_AfterRowUpdate(object sender, RowEventArgs e)

{

            OtEntities.SaveChanges();

}

I don't think this is a coding error and rather a glitch with the WinGrid itself. Or may be there are some other properties I need to set which I am missing.