Hi
I had the following Server Error after including a RadAjaxManager to a Webpage:
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
In many forums they said to be sure to remove all code blocks (<% %>) in the Head-Section of the Page.
Or delete the runat="server" from the Head-Section.
Noting helped in my case. But the ting with the code blocks helped me find it out.
It had nothing to do with the Head-Section of the Page or the Master-Page.
I simply had to remove the code blocks IN my page.
That's the page-code that produces the Error:
I had the following Server Error after including a RadAjaxManager to a Webpage:
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
In many forums they said to be sure to remove all code blocks (<% %>) in the Head-Section of the Page.
Or delete the runat="server" from the Head-Section.
Noting helped in my case. But the ting with the code blocks helped me find it out.
It had nothing to do with the Head-Section of the Page or the Master-Page.
I simply had to remove the code blocks IN my page.
That's the page-code that produces the Error:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="CollectionModifyProblem._Default" %> |
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml" > |
<head runat="server"> |
<title>Untitled Page</title> |
</head> |
<body> |
<form id="form1" runat="server"> |
<telerik:RadScriptManager ID="RadScriptManager1" runat="server"> |
</telerik:RadScriptManager> |
<div> |
<%="Select a Brand (norally I use a var here):"%> |
<telerik:RadListBox ID="lstbBrands" runat="server"></telerik:RadListBox> |
<%="Select a Type: (norally I use a var here)"%> |
<telerik:RadListBox ID="lstbCarTypes" runat="server"></telerik:RadListBox> |
</div> |
<telerik:RadAjaxManager runat="server"> |
<AjaxSettings> |
<telerik:AjaxSetting AjaxControlID="lstbBrands"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="lstbCarTypes" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
</AjaxSettings> |
</telerik:RadAjaxManager> |
</form> |
</body> |
</html> |
After a while I replaced the two code-blocks with labels:
<%="Select a Brand (norally I use a var here):"%> |
to |
<asp:Label runat="server" ID="lblTitle_Brands">Select a Brand (noraly I fill this by code):</asp:Label> |
and
<%="Select a Type (norally I use a var here):"%> |
to |
<asp:Label runat="server" ID="lblTitle_Type">Select a Type (noraly I fill this by code):</asp:Label> |
That's all you have to do!
Maybe this will help also others!
Freundliche GrĂ¼sse
Marcel