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

2019 R1 Grid Stack Overflow on Template columns

12 Answers 765 Views
Grid
This is a migrated thread and some comments may be shown as answers.
eSimSE
Top achievements
Rank 1
eSimSE asked on 14 Feb 2019, 04:12 PM

After upgrading to 2019 R1, grid template columns that used to work are no longer working. I am getting a stack overflow error. I believe that I have updated all of my files appropriately. Is anyone else having this problem?

columns.Template(@<text></text>)

.ClientTemplate("<button class=\"k-button\" name=\"groupBtn\" onclick=\"EditGroups('#=Id#')\"><span class='k-icon k-i-edit'></span></button>")
.HeaderHtmlAttributes(App.HdrAttr)
.HtmlAttributes(App.BtnAttr)
.Title("Districts");

12 Answers, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 18 Feb 2019, 09:24 AM
Hello,

I have tested the same column on my end and it seems to be working as expected. Note that within the click handler I simply logged a message in the console.

Could you please make sure that the endless loop is not due to the logic within the click handler?

Also, could you send us the whole error message including the stack trace?

Having said that, sharing a demo that clearly replicates the issue would definitely help us fully understand the case and we will be able to provide further assistance to the best of our knowledge.


Regards,
Georgi
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.

0
Emmsa
Top achievements
Rank 2
answered on 22 Feb 2019, 11:40 PM

Hi,

I'm hijacking this thread to report a similar problem with Telerik UI for ASP.NET Core. I know that it's technically a different product, but my issue:

  • is also related to template columns
  • started to appear with the 2019 R1 release of the Grid
  • is also about a stack overflow

Example code:

<div class="row">
    <div class="col-md-12">
        @(Html.Kendo().Grid<ProductViewModel>()
            .Name("gridAjusteBajaPosterior")
            .Columns(columns =>
            {
                columns
                    .Template("<input id='chk#=ProductID#' type='checkbox' class='k-checkbox row-checkbox'><label style='text-align: right; margin-top: 3px; margin-left: 10px;' class='k-checkbox-label' for='chk#=ProductID#'></label>")
                    .Width(ViewBag.GridButtonColumnWidth)
                    .HtmlAttributes(new { style = "white-space: nowrap" })
                    .ClientHeaderTemplate("<input id='chkSelectAll' type='checkbox' class='k-checkbox row-checkbox'><label style='text-align: right; margin-top: 3px; margin-left: 10px;' class='k-checkbox-label' for='chkSelectAll'></label>");

                columns.Bound(m => m.ProductID);
                columns.Bound(m => m.ProductName);

            })
            .Sortable()
            .Pageable()
            .AutoBind(true)
            .DataSource(dataSource => dataSource
                .Custom().Transport(t => t.Read(r => r.Url("https://demos.telerik.com/kendo-ui/service/products").DataType("jsonp")))
            )
        )
    </div>
</div>

View Model:

    public class ProductViewModel
    {
        public int ProductID { get; set; }

        public string ProductName { get; set; }
    }

 

Some details:

  • this worked perfectly fine up to at least 2018 R2 (2018.2.620). It stopped working when I upgraded to 2019 R1 (2019.1.220), without any changes on the code from my part (I jumped straight from 2018 R2 to 2019 R1, so I can't comment on 2018.3.911)
  • the above code only breaks if I set the column with with a value from ViewBag. I'm checking that the ViewBag (and the GridButtonColumnWidth property) is not null. Currently it's value is 87. If I use that value directly, it works just fine.
  • it only breaks on template columns. Setting the column with using the ViewBag on regular columns works just fine.
  • I'm getting a StackOverflowException

Console output:

Emmsa.Test> info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]

Emmsa.Test>       Executed action method Emmsa.Test.Controllers.TestControllerIndex (Emmsa.Test), returned result Microsoft.AspNetCore.Mvc.ViewResult in 0.2429ms.

Emmsa.Test> info: Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor[1]

Emmsa.Test>       Executing ViewResult, running view Index.

Emmsa.Test>

Emmsa.Test> Process is terminated due to StackOverflowException.

 

0
Georgi
Telerik team
answered on 26 Feb 2019, 11:41 AM
Hello Emmsa,

I have tested the very same column on my end but it seems to be working as expected. For your convenience I am attaching the sample I used for testing. Please examine it and let me know what I am missing.

Furthermore, could you please try to explicitly cast the value from the ViewBag and let me know if the issue still occurs?

e.g.

.Width((int)ViewBag.GridButtonColumnWidth)


Regards,
Georgi
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Emmsa
Top achievements
Rank 2
answered on 27 Feb 2019, 02:30 PM

Hi Georgi,

Thanks for your testing! I'm sorry for not getting back to you sooner, but I'm in the middle of a release, and I'll need more time to give you a definitive answer. From a quick test, I can confirm the attached sample works. So I'll need to look a bit deeper into the issue, as this implies there's something else at play.

In the mean time I've rolled back to 2018 R2 for the time being, but I'll definitely look at this later this week as I'm very much interested in finding the root issue and solve it.

Regards,

 

0
Georgi
Telerik team
answered on 28 Feb 2019, 12:32 PM
Hi Emmsa,

Take your time to examine the sample. Once you are done examining the sample let me know what are the steps to reproduce the issue and I will further investigate the case.


Regards,
Georgi
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Emmsa
Top achievements
Rank 2
answered on 01 Mar 2019, 01:44 PM

Hi Georgi,

After some further testing, I can confirm that if I explicitly cast the value from the ViewBag to int, the issue disappears, at least in the few cases in which I tried it. This is a pattern I use in a lot of places, so the testing is not 100% conclusive, but still.

So, a preliminary conclusion would be that *something* seem to have changed between 2018 R2 and 2019 R1, making the explicit cast in this scenario mandatory. Is this the expected behavior? This wasn't the case before, at least up to with 2018 R2. I'm curious about where the suggestion about the explicit cast comes from.

I've not been able to reproduce the issue in your example yet, though. I'd need some more time for that. I couldn't find out what needs to be added (or removed) from the sample to reproduce the issue there yet.

Best regards,

--
Javier

 

0
Georgi
Telerik team
answered on 05 Mar 2019, 09:04 AM
Hello Javier,

I have examined the commits for the GridColumnBase.cs class and I can confirm that there are no modifications for the Width configuration with the latest release. Having said that, the change might be in the .Net Core framework - not in the Kendo library.

Generally speaking, C# is a strongly typed language and working with dynamics is not a good practice. I would recommend casting the values to their corresponding types when possible.


Regards,
Georgi
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Brianna
Top achievements
Rank 1
answered on 24 Jul 2019, 09:51 PM

I was having the same issue with 2019 R2, and did not have the issue with the previous version used, 2018 R3 SP1.

I had a template column, as designed below, with the Title from the ViewBag. Casting ViewBag.DisplayNameTitle to a string fixed the StackOverflowException.

c.Template(e => e.DisplayName)
    .Title(ViewBag.DisplayNameTitle)
    .ClientTemplate(
        "<span " +
            "#if(IsDeleted) {#" +
                "style=\"text-decoration:line-through; color:red;\" " +
            "#}#" +
        ">#=DisplayName#</span>");
0
Brianna
Top achievements
Rank 1
answered on 24 Jul 2019, 09:53 PM
I should note, I am using ASP.NET MVC, not .NET Core.
0
Georgi
Telerik team
answered on 26 Jul 2019, 11:57 AM
Hello Brianna,

Is casting the value from the view bag not an option for you?

Have you considered including this data to the viewmodel of the current page?


Regards,
Georgi
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Brianna
Top achievements
Rank 1
answered on 26 Jul 2019, 01:46 PM
Casting ViewBag.DisplayNameTitle to a string fixed the StackOverflowException.
0
Ram
Top achievements
Rank 1
answered on 14 Sep 2019, 04:18 PM
Had same issue when upgrading Kendo to 2019 R2, applying explicit casting fixed the issue.
Tags
Grid
Asked by
eSimSE
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Emmsa
Top achievements
Rank 2
Brianna
Top achievements
Rank 1
Ram
Top achievements
Rank 1
Share this question
or