Hello,
I'm evaluating the GridView component. In any case there will be no detail data bound to the grid.
Only if I'm using AutoGenerateHierarchy = true the detail will appear.
Previous steps in the designer:
- Defined two columns for master template (Vorname, Nachname) -> FieldName and HeaderText
- Created a new template called 'childTemplate' and add two columns (Firma, Ort) -> FieldName and HeaderText
As follow the code behind:
Thank you for any assistance.
Kind regards,
Danny
I'm evaluating the GridView component. In any case there will be no detail data bound to the grid.
Only if I'm using AutoGenerateHierarchy = true the detail will appear.
Previous steps in the designer:
- Defined two columns for master template (Vorname, Nachname) -> FieldName and HeaderText
- Created a new template called 'childTemplate' and add two columns (Firma, Ort) -> FieldName and HeaderText
As follow the code behind:
using System;using System.Collections.Generic;using System.Windows.Forms;using Telerik.WinControls.UI;namespace TestForm{ public partial class Form1 : Form { private readonly List<Person> _personen = new List<Person>(); public Form1() { InitializeComponent(); _personen.AddRange(new[] { new Person {Vorname = "Danny", Nachname = "Meier", Jobs = new List<Job> { new Job {Firma = "Heiniger & Partner AG", Ort = "Wetzikon"}, new Job {Firma = "Scor AG", Ort = "Zürich"}, new Job {Firma = "ERNI Consulting AG", Ort = "Zürich"} }}, new Person {Vorname = "Michael", Nachname = "Bolliger", Jobs = new List<Job>()}, new Person {Vorname = "Daniel", Nachname = "Kuster", Jobs = new List<Job> { new Job {Firma = "Heiniger & Partner AG", Ort = "Wetzikon"} }} }); } private void Form1Load(object sender, EventArgs e) { radGridView1.AutoGenerateHierarchy = false; var relation = new GridViewRelation(radGridView1.MasterTemplate, childTemplate); relation.ChildColumnNames.Add("Job"); radGridView1.Relations.Add(relation); radGridView1.DataSource = _personen; } } public class Person { public string Vorname { get; set; } public string Nachname { get; set; } public List<Job> Jobs { get; set; } } public class Job { public string Firma { get; set; } public string Ort { get; set; } }}Thank you for any assistance.
Kind regards,
Danny