At this moment I'm busy with evaluation the Telerik RadGrid in combination with NetTier. I'm trying to make the master/detail functionality working. I tried to do this at design time and in code. I looked at the examples but all of them used dataset instead of list of objects. I think that I make a mistake when setting the key for the master and for the detail in the relation ship The reason for this thinking is that I have the same problem when I add a combobox The combobox is filled but the underlaying value (the text instead of the id (FK)) is not showed (same for the detail)
I tried several things like getting the data for the master and for the details separatly or by using a deepload but nothing works (except for one time but instead of displaying the detail data the grid showed the master data in the detail data so it was a one on one situation but offcourse not correct) Below you will find the code of my last attempt (purly in code not in design) Maybe someone call tell me what is wrong or can give me an working example Thanks for your time.
The code is for binding modules (the master) to modules session (an in between table in the database) The key fields have the same name
//Get the data for the master
EducationModuleService serviceModule = new EducationModuleService();
TList<EducationModule> modules = serviceModule.GetAll();
grdvModules.DataSource = modules;
//Get the data for the Detail
EducationModuleSessionService serviceModuleSession = new EducationModuleSessionService();
TList<EducationModuleSession> moduleSession = serviceModuleSession.GetAll();
// bindingSourceModuleSession.DataSource = moduleSession;
//Create the Detail template
Telerik.WinControls.UI.
GridViewTemplate templateModuleSessions = new Telerik.WinControls.UI.GridViewTemplate();
templateModuleSessions.AllowAddNewRow =
false;
templateModuleSessions.DataSource = moduleSession;
templateModuleSessions.SummaryDisplayStyle = Telerik.WinControls.UI.
SummaryDisplayStyle.None;
//Add the detail template to the master template
this.grdvModules.MasterGridViewTemplate.ChildGridViewTemplates.AddRange(new Telerik.WinControls.UI.GridViewTemplate[] {
templateModuleSessions});
//Create the relation and add it the the RadGridView
GridViewRelation relation = new GridViewRelation(this.grdvModules.MasterGridViewTemplate);
relation.ParentColumnNames.Add(
"EducationModuleId");
relation.ChildColumnNames.Add(
"EducationModuleId");
relation.ChildTemplate = templateModuleSessions;
relation.RelationName =
"ModulesSessions";
this.grdvModules.Relations.Add(relation);