DataKeyNames
You must set the DataKeyNames property of every parent table view in the hierarchy to specify the fields in the table's data source that are used for linking to child tables. The DataKeyNames property must list the exact names of these fields as they appear in the parent table's data source.If multiple fields are needed for linking to child tables, you can list them in the ASPX file, separating their names with commas (but no spaces):
MasterTableView DataKeyNames="CustomerID,EmployeeID" >DataKeyNames is an array of strings, so if you are creating the grid's structure at runtime, assign each field name as a separate array entry:
RadGrid1.MasterTableView.DataKeyNames = new string[2] { "CustomerID", "EmployeeID" };asp:AccessDataSource ID="AccessDataSource1" DataFile="~/Grid/Data/Access/Nwind.mdb"
SelectCommand="SELECT * FROM Customers" runat="server">/asp:AccessDataSource>
asp:AccessDataSource ID="AccessDataSource2" DataFile="~/Grid/Data/Access/Nwind.mdb"
SelectCommand="SELECT * FROM Orders Where CustomerID = ?" runat="server">
SelectParameters>
asp:Parameter Name="CustomerID" Type="string" />
/SelectParameters>
/asp:AccessDataSource>
asp:AccessDataSource ID="AccessDataSource3" DataFile="~/Grid/Data/Access/Nwind.mdb"
SelectCommand="SELECT * FROM [Order Details] where OrderID = ?" runat="server">
SelectParameters>
asp:Parameter Name="OrderID" Type="Int32" />
/SelectParameters>
/asp:AccessDataSource>
ParentTableRelation>
telerik:GridRelationFields
DetailKeyField="DepartmentID"
MasterKeyField="DepartmentID" />
telerik:GridRelationFields
DetailKeyField="ManagerID"
MasterKeyField="EmployeeID" />
/ParentTableRelation>