views:

179

answers:

0

I'm using a GridView and a LinqDataSource to display data from an entity called CHILD in this example. CHILD has an association with the PARENT entity.

I'm having no problems displaying data from both these entities in a single GridView since related PARENT records are exposed as a property in CHILD. However, I can't figure out a way to update records in the PARENT entity

I've created a property that exposes the PARENT field I want to update in the CHILD entity

partial class CHILD
{
    public string ParentField
    {
        get { return PARENT.FieldFromParent; }
        set { PARENT.FieldFromParent = value; }
    }
}

I get this error message when I try to set (never when I get) the PARENT field "Object reference not set to an instance of an object".

Anyone have any ideas? Maybe I'm going about this the wrong way. Ideally I want one GridView that can update records from both entities.