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

Collection was modified; enumeration operation may not execute.

3 Answers 256 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Mohammed
Top achievements
Rank 1
Mohammed asked on 04 Nov 2013, 06:48 AM

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 .
 

3 Answers, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 07 Nov 2013, 07:16 AM
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.
0
Mohammed
Top achievements
Rank 1
answered on 07 Nov 2013, 08:01 AM

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 .


0
Accepted
Angel Petrov
Telerik team
answered on 08 Nov 2013, 03:23 PM
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.
Tags
Ajax
Asked by
Mohammed
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
Mohammed
Top achievements
Rank 1
Share this question
or