Hi,
My data model looks like this, but I'm not sure how to map it to the grid.
It gives an error saying it isn't enumerable, which is true. How do I map complex fields as a sub-grid row?
public class MainModel
{
public DetailsModel Order { get; set; }
public DetailsModel2 Stuff { get; set; }
}
public class DetailsModel
{
public string OrderId { get; set; }
public string DealSize { get; set; }
}
public class DetailsModel2
{
public string StuffId { get; set; }
public string StuffSize { get; set; }
}
private List<MainModel> GenerateData()
{
List<MainModel> data = new List<MainModel>();
for (int i = 0; i < 5; i++)
{
MainModel mdl = new MainModel()
{
Order = new DetailsModel() { OrderId = i.ToString(), DealSize = i.ToString() }
,
Stuff = new DetailsModel2() { StuffId = i.ToString(), StuffSize = i.ToString() }
};
data.Add(mdl);
}
return data;
}
<TelerikGrid Data="salesTeamMembers">
<DetailTemplate Context="TemplateItem">
@{
var Item = TemplateItem as MainModel;
<TelerikGrid Data="Item.Order" Pageable="true" PageSize="5">
<GridColumns>
<GridColumn Field="OrderId"></GridColumn>
<GridColumn Field="DealSize"></GridColumn>
</GridColumns>
</TelerikGrid>
}
</DetailTemplate>
<GridColumns>
<GridColumn Field="Order">Order</GridColumn>
<GridColumn Field="Stuff">Stuff</GridColumn>
</GridColumns>
</TelerikGrid>