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

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

1 Answer 243 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Gidon
Top achievements
Rank 1
Gidon asked on 06 Sep 2017, 11:01 AM

I'm trying to implement a MaintainScrollPositionOnPostBack because I've had to move the 'overflow' from my BODY element to a child DIV (to resolve a touch-scrolling issue with RadComboBoxes in newer versions of Chrome.) The problem I'm running into is getting my hidden field AJAXified with the rest of my controls.

If I disable AJAX entirely, the script works perfectly (because the hidden field value is being persisted across postbacks.)

If I enable AJAX but exclude the hidden field from the RadAjaxManager AjaxSettings AjaxUpdatedControl the page works as expected, but the script doesn't (because the hidden field value isn't being persisted across postbacks.)

If I enable AJAX and include the hidden field in the RadAjaxManager's AjaxSettings AjaxUpdatedControl I get a "The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)." exception.

The page in question has no scripts on it. The MasterPage's scripts are all wrapped in RadCodeBlock tags. I can't remove the HEAD element's runat="server" because of use. The problem occurs with both  and input "s. Wrapping the hidden field in a RadCodeBlock prevents the exception, but does not persist the hidden field's value across postbacks.

Any suggestions you could offer that might point me in the right direction would be appreciated. (And no, I can't post the code--the site part of is proprietary and extremely sprawling.)

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 12 Sep 2017, 06:42 AM
Hi Gidon,

You can try to enable the following property:
<telerik:RadAjaxManager ... EnablePageHeadUpdate="true">

Also, please check whether there is any script which is not included in the block. Another thing you can try is to replace the code blocks with script blocks:
http://docs.telerik.com/devtools/aspnet-ajax/controls/ajax/radcodeblock-and-radscriptblock

I hope this will prove helpful.

Regards,
Eyup
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Ajax
Asked by
Gidon
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or