I have a DevExpress gridview which works as it should, but... in the binded model it's also a collection of "VisitTypes" i'm not sure how to handle..
It's a list (collection) of type "VisitTypeSummary".
What i'm trying to do is add a new column for each item in this collection. The Collection looks like this :
- VisitTypeId
- Name
- Count
So the result should look something like this (if the nr. of items is 3) :
- Col1 : Area
- Col2 : Name
- Col3 : Address
- Col4 : VisitTypeSummary[0].Name
- Col5 : VisitTypeSummary[1].Name
- Col6 : VisitTypeSummary[2].Name
- Col7 : LastVisited
etc.etc.etc....
The issue is i dont know how to actually.. access the Model in the PartialView, and i'm trying to accomplish this by doing a foreach(var item in Model.VisitTypeSummary) but it seems and smells wrong..
Here is some code :
var grid = Html.DevExpress().GridView(settings => {
-- etc -->
settings.Columns.Add("AntButikkMedBesoeksKode");
settings.Columns.Add("BesoeksProsent");
foreach (var VisitTypeSummary in the-model-i-cannot-figure-out) )
{
// add new column to the gridview
}
settings.Columns.Add("AntKundeBesoek");
settings.Columns.Add("SumBesoekForSelger");
settings.Columns.Add("SnittBesoekPrDagSelger");
// and bind it in the end..
@grid.Bind(Model).GetHtml()
So.. anyone know how i can do this ? Been googlin' for a while now, but no success.