Hi all
I'm running into an annoying problem with the grid colum template.
I have a ASP.NET MVC 4 app that use a kendo grid to render a set of dynamic column.
The razor code of the view is something like this
The problem is that in debug mode this snippet work properly and produce the expected result.
Once deployed (on a Windows Server 2008 R2, IIS 7.5) the snippet render the right number of column but in all of them show data of the last item
of the collection Model.SettimaneVisibili on which i'm iterating.
I've attached two images that show the good (expected) result, and the wrong one.
Any Idea?
I'm running into an annoying problem with the grid colum template.
I have a ASP.NET MVC 4 app that use a kendo grid to render a set of dynamic column.
The razor code of the view is something like this
<
div
>
@(Html.Kendo().Grid(Model.Items)
.Name("GridReportCommerciale")
.Columns(columns =>
{
columns.Bound(p => p.Workcentre)
.Template(@<
div
onclick
=
"openVincoli('@item.Workcentre')"
class
=
"contentCell"
style
=
"font-weight:bold;font-size:11px"
>@item.Workcentre</
div
>)
.Title("WC").Width(60);
foreach (var sett in Model.SettimaneVisibili)
{
columns.Template(@<
text
>
@if (item[sett.Clone()] != null && item[sett.Clone()].Diametro > 0)
{
if (item[sett].Stato == "R")
{
<
div
onclick
=
"openCampaign('@item[sett.Clone()].RiferimentoCampagna')"
class
=
"contentCell"
style
=
"background-color:#FF8C00;"
>
<
div
>@string.Format("{0:0.00}", item[sett.Clone()].Diametro)</
div
>
<
div
>@string.Format("({0:#,##0})", item[sett.Clone()].Quantita)</
div
>
</
div
>
}
else
{
<
div
onclick
=
"openCampaign('@item[sett.Clone()].RiferimentoCampagna')"
class
=
"contentCell"
style
=
"background-color:#FFFFE0;"
>
<
div
>@string.Format("{0:0.00}", item[sett.Clone()].Diametro)</
div
>
<
div
>@string.Format("({0:#,##0})", item[sett.Clone()].Quantita)</
div
>
</
div
>
}
}
else
{
<
div
class
=
"contentCell"
>
<
div
> </
div
>
<
div
> </
div
>
</
div
>
}
</
text
>)
.HeaderTemplate(
@<
div
>
<
div
>@string.Format("{0:00}-{1:0000}", sett.Clone().NumeroSettimana, sett.Clone().Anno)</
div
>
<
div
>@string.Format("{0}", sett.Clone().GetDayRange())</
div
>
</
div
>)
.Width(70);
}
})
.Scrollable()
.ToolBar(t=>{
t.Template(@<
div
class
=
"k-toolbar k-grid-toolbar k-grid-top"
>
<
a
class
=
"k-button k-button-icontext "
href
=
"/ReportCommerciali?pos=-1"
>
<
span
></
span
>
Indietro
</
a
>
<
a
class
=
"k-button k-button-icontext "
href
=
"/ReportCommerciali?pos=1"
>
<
span
></
span
>
Avanti</
a
>
<
span
>@Model.VisibleRangeDescription</
span
>
</
div
>);
})
//.Resizable(resize => resize.Columns(true))
//.Reorderable(reorder => reorder.Columns(false))
.HtmlAttributes(new { style = "height: 700px;" })
)
</
div
>
The problem is that in debug mode this snippet work properly and produce the expected result.
Once deployed (on a Windows Server 2008 R2, IIS 7.5) the snippet render the right number of column but in all of them show data of the last item
of the collection Model.SettimaneVisibili on which i'm iterating.
I've attached two images that show the good (expected) result, and the wrong one.
Any Idea?