I have a grid whose datasource is a list of DocumentGroup objects, each of which has a property "Others" of type IEnumerable<Document>.
I wrote the following:
GridViewTemplate childTemplate = new GridViewTemplate(); grdDocuments.Templates.Add(childTemplate); childTemplate.Columns.Add(new GridViewTextBoxColumn(nameof(Document.Docname))); childTemplate.Columns.Add(new GridViewTextBoxColumn(nameof(Document.Filepath))); GridViewRelation relation = new GridViewRelation(grdDocuments.MasterTemplate, childTemplate); relation.ChildColumnNames.Add(nameof(CompanyTb.DocumentGroup.Others)); childTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; grdDocuments.Relations.Add(relation); grdDocuments.Fill(Data.DocumentGroups);
(I'm not showing the whole setup of grdDocuments.)
This basically works, in that it shows a row for each DocumentGroup with the data in their columns, plus an icon to the left of each allowing the user to open the associated sub-grid of Documents. Clicking on that icon gives me the correct number of rows under each DocumentGroup and each row has two columns (one for the Docname property and one for the Filepath property).
The only problem is that all the cells in all the Document rows are empty, even though there's data in the objects behind them.
What am I missing?