I have what I hope is a simple question, but I can't seem to find an example. I have the following object structure (for example):
I want to bind a list of Invoice to this hierarchical grid using HierarchyLoadMode="Client" , preferably declaratively, and without hooking DetailTableDataBind (I have already solved it this way, but it seems there should be a much better way). Is there a way to express the relationship? All the data is preloaded and ready to be bound.
Current Solution:
Thanks,
Mark Huber
public class Invoice{ public int InvoiceId { get; set; } public string CustomerName { get; set; } public double Total { get; set; } public List<InvoiceLineItem> LineItems { get; set;}}public class InvoiceLineItem{ public string Description { get; set; } public int Quantity { get; set; } public decimal Rate { get; set; } public decimal Total { get { return Quantity * Rate; } }}I want to bind a list of Invoice to this hierarchical grid using HierarchyLoadMode="Client" , preferably declaratively, and without hooking DetailTableDataBind (I have already solved it this way, but it seems there should be a much better way). Is there a way to express the relationship? All the data is preloaded and ready to be bound.
Current Solution:
protected void RadGridInvoices_DetailTableDataBind(object sender, GridDetailTableDataBindEventArgs e){ var invoices= e.DetailTableView.DataSource as IEnumerable<Invoice>; if (invoices != null) { string invoiceId =e.DetailTableView.ParentItem.GetDataKeyValue("InvoiceId").ToString(); var invoice = invoices.First(inv => inv.InvoiceId == invoiceId); e.DetailTableView.DataSource = invoice.LineItems; }}Thanks,
Mark Huber