Hi to all,
I have this collection routine
contacts = from rec
in
_context.Contacts.Include(
"SellToContacts"
)
where rec.ParentContactFK.HasValue ==
false
select rec;
DataSourceResult result = contacts.ToDataSourceResult(request);
return
Json(result);
Contact model is configured in this mode
[...]
public
Contact ContactParent {
get
;
set
; }
[Column(
"Parent Contact Id"
, TypeName =
"int"
)]
[Display(Name =
"Società Principale"
)]
public
int
? ParentContactFK {
get
;
set
; }
[ForeignKey(
"ParentContactFK"
)]
public
ICollection<Contact> SellToContacts{
get
;
set
; }
[...]
with this collection I would show a column that shows a Count of SellToContacts, that there are children of primary contact.
If a try to debug a collection, I found , correctly, some SellToContacts loaded of several children.
[...]
@(Html.Kendo().Grid<
Portale.Web2.Data.Entities.Contact
>
()
.Name("contactGrid")
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("GetContacts", "Contacts").Data("addInfo"))
)
.Columns(columns =>
{
columns.Bound(c => c.Date).Format("{0:dd/MM/yyyy}");
columns.Bound(c => c.Name);
columns.Bound(c => c.SellToContacts.Count);
[...]
Why not appears into a grid?
Where I wrong?