I have an List<Examination> datasource where each record contains two objects. I want to bind datakeynames property with the pkIds of both objects e.g.
<asp:GridView DataKeyNames="obj1.pkId, obj2.pkId" ... />
I am binding the grid programatically. but I get error indicating:
DataBinding: 'objectList' does not contain a property with the name 'obj1.pkId'
Way around will be much appreciated.
Edit
class Examination
{
public string name{get;set;}
public TestClass test{get;set;}
public Subject subject{get;set;}
}
class TestClass
{
public int testId{get;set;}
}
class Subject
{
public int subjectId{get;set;}
}
Expected DataKeyNames are "test.testId, subject.subjectId" which makes Examination class objects unique.
My ObjectDataSource would be bound to List<Examination>