Collection was modified; enumeration operation may not execute. exception when setting the grid RetainExpandStateOnRebind="True"

1 Answer 115 Views
Grid
Rodulfo
Top achievements
Rank 1
Rodulfo asked on 12 Jan 2023, 05:48 AM
Good day,

An error is thrown when I set the RetainExpandStateOnRebind = "True" after a partial postback. Here's the sample code that replicate the issue.

Scenario: selecting a row (with collapsed detail) 

1 Answer, 1 is accepted

Sort by
0
Attila Antal
Telerik team
answered on 16 Jan 2023, 06:00 PM

Hello Rudolfo,

Thanks for sharing a sample project. I tested it with the latest Telerik version and the described problem cannot be replicated.

From the Code, I can see that an old version is used, which is 2017.

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI, Version=2017.1.228.45, Culture=neutral, PublicKeyToken=121fae78165ba3d4" %>

Perhaps there were some related issues with that version. I suggest upgrading the Telerik and trying again.

 

Regards,
Attila Antal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Rodulfo
Top achievements
Rank 1
commented on 01 Feb 2023, 01:25 PM

I tried to re-run your attached solution but still able to replicate the issue. I have attached a screen recording on how I was able to replicate the issue.
https://www.screencast.com/t/t5DXxljQkf
Thanks
Attila Antal
Telerik team
commented on 03 Feb 2023, 03:39 PM

Hi Rodulfo,

Thanks for the additional information. I was able to replicate the problem. This is rather related to the HierarchyLoadMode. If set to Client, the RetainExpandStateOnRebind property is not required. The expanded state is being saved and carried across PostBacks automatically.

Only if you have the HierarchyLoadMode set to ServerBind or ServerOnDemand,  the Grid will look for the expanded state, and if it finds one, it will render the Child Tables as expanded.

Yunier
Top achievements
Rank 1
commented on 04 Aug 2023, 03:34 PM

Hi Attila, 

Is there a wiki that expands on how to use HierarchyLoadMode?

My application ran into the issue described here, "Collection was modified; enumeration operation may not execute", today. I'm running on  Kendo UI for JQuery version 2021.3.914 and I can't find anything related to HierarchyLoadMode in the Kendo UI for JQuery documentation.

Doncho
Telerik team
commented on 09 Aug 2023, 06:35 AM

Hi Yunier,

The HierarchyLoadMode property is exposed by the server-side RadGrid Control for ASP.NET AJAX and it is documented here:

The discussion in this forum is targeting the server-side RadGrid control for ASP.NET AJAX but not the Kendo jQuery client-side Grid Widget.

If the case here is about the Kendo UI Grid for jQuery I would recommend researching the Kendo Forum for issues similar to the one you are facing. Or open a new forum thread there so you can get the most accurate assistance.

Tags
Grid
Asked by
Rodulfo
Top achievements
Rank 1
Answers by
Attila Antal
Telerik team
Share this question
or