This is a migrated thread and some comments may be shown as answers.

Kendo GRID different behavior on column template between local debug and deployed site

2 Answers 102 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Matteo
Top achievements
Rank 2
Matteo asked on 30 Oct 2013, 09:51 AM
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

<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?

2 Answers, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 31 Oct 2013, 08:50 AM
Hello Matteo,

This behavior is indeed abnormal and I am afraid that the attached code snippets and screenshots do not reveal enough information on what is causing this. Could you please provide a runnable project where the issue is reproduced? This would help us pinpoint the exact reason for this behavior and advise you further. In case you do not want to or legally cannot send us a copy of the project, then I would recommend checking the following blog posts. They can help you isolate the issue in a sample project that you can share with us:

Regards,
Alexander Popov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Matteo
Top achievements
Rank 2
answered on 31 Oct 2013, 10:38 AM
Hello Alexander

First of all I apologize to have stolen your time.

This issue wasn't related to Kendo stuff but it seems to be a Framework version problem.

I don't know exactly why, but installing on the deployment environment the v4.5 of the .NET framework all turns to work fine.

I didn't try earlier this way to solve the problem because the target framework of my web app is still the v4. Maybe some patch that fix this behaviour
is included in v4.5

Thank you for the assistence.
Tags
Grid
Asked by
Matteo
Top achievements
Rank 2
Answers by
Alexander Popov
Telerik team
Matteo
Top achievements
Rank 2
Share this question
or