Collection was modified; enumeration operation may not execute.

4 posts, 1 answers
  1. Mohammed
    Mohammed avatar
    16 posts
    Member since:
    Nov 2013

    Posted 04 Nov 2013 Link to this post


    hi,

    i have a usercontrol with radgrid that have a RadTabStrip in its nestedviewtemplet and in tab there is usercontrols and each control has it's 

    i am using this code to update radgrids in all controls even the parent control

      
    Dim ParentPageAjaxManager As RadAjaxManager = RadAjaxManager.GetCurrent(Page)
    ParentPageAjaxManager.AjaxSettings.AddAjaxSetting(ParentPageAjaxManager,
    Me.StudentsMasterProgramsListRadGrid)
     AddHandler ParentPageAjaxManager.AjaxRequest, AddressOf ParentPageAjaxManager_AjaxRequest

    when compile i get this error "Collection was modified; enumeration operation may not execute."

    so i tried to remove this line 

    ParentPageAjaxManager.AjaxSettings.AddAjaxSetting(ParentPageAjaxManager,
                            Me.StudentsMasterProgramsListRadGrid)


    from all child controls and leave it in the parent control and it worked!!

    and rad grids in controls in nestedtemplete update like i want 

    but the problem when i want to use those child controls ((not in a rad grid))) then radgrids in child controls won't update by ajaxmanger .


    could someone please explain this to me and gave me a solution .
     

  2. Angel Petrov
    Admin
    Angel Petrov avatar
    1006 posts

    Posted 07 Nov 2013 Link to this post

    Hi Mohammed,

    I am not sure that I fully understand the scenario. Could you please elaborate more on the exact application structure? If I am correct the controls which are placed inside the NestedViewTemplate are also being loaded outside of the grid. In such scenarios in order to ajaxify the content properly you should also add AJAX settings for the controls outside the NestedViewTemplate.

    Please provide e more detail explanation of the scenario thus facilitating us in providing a more accurate answer.

    Regards,
    Angel Petrov
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mohammed
    Mohammed avatar
    16 posts
    Member since:
    Nov 2013

    Posted 07 Nov 2013 Link to this post


    hi Angel , 

    i have a custom control let say it's ID (webusercontrol1) , this control have an AjaxifiedRadGrid (StudentsMasterProgramsListRadGrid) By this Code 

    ParentPageAjaxManager.AjaxSettings.AddAjaxSetting(ParentPageAjaxManager,
                            Me.StudentsMasterProgramsListRadGrid)


    when i put webusercontrol1 in a page thee is no problem , but when i put it in nestedview templete of an Ajaxified radgrid  the error shows up .

    so i thought the error happened because  there is an Ajaxified control inside an Ajaxified control therefor i unAjaxified the radgrid inside webusercontrol1 by removing the code i mentioned up . and it worked .


  5. Answer
    Angel Petrov
    Admin
    Angel Petrov avatar
    1006 posts

    Posted 08 Nov 2013 Link to this post

    Hi Mohammed,

    The problem is caused by the double ajaxification. In such scenarios nested update panels will created and this will break the functionality. Note that nesting the panels in such manner is not supported by the MS AJAX framework.

    Regards,
    Angel Petrov
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top