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. <% ... %>).2

1 Answer 200 Views
Grid
This is a migrated thread and some comments may be shown as answers.
umut
Top achievements
Rank 1
umut asked on 15 Aug 2008, 02:18 PM
Hello, this is the error i got , when i try to go to the page.

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

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).]
            System.Web.UI.ControlCollection.AddAt(Int32 index, Control child) +2108046
            Telerik.Web.UI.RadAjaxControl.MoveUpdatePanel(Control initiator, Control updated) +123
            [HttpException (0x80004005): Please, see whether wrapping the code block, generating the exception, within RadCodeBlock resolves the error.]
            Telerik.Web.UI.RadAjaxControl.MoveUpdatePanel(Control initiator, Control updated) +171
            Telerik.Web.UI.RadAjaxControl.PerformRender() +418
            Telerik.Web.UI.RadAjaxControl.OnPageRender(HtmlTextWriter writer, Control page) +1222
            Telerik.Web.UI.RadAjaxControl.RenderPageInAjaxMode(HtmlTextWriter writer, Control page) +87
            System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +98
            System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20
            System.Web.UI.Page.Render(HtmlTextWriter writer) +26
            System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
            System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121
            System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
            System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2558
            

i searched it in forums, an answer tells that this is a javascript error and try moving the code from <head> to <body> ,but since i used a masterpage, i can't do this, is there any answer for this?
help will be appriciated :)

1 Answer, 1 is accepted

Sort by
0
Missing User
answered on 15 Aug 2008, 02:43 PM
Hi umut,


To avoid the exception when using server tags for expression evaluation, you will need to wrap your code in RadCodeBlock.

Sincerely yours,
Plamen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
umut
Top achievements
Rank 1
Answers by
Missing User
Share this question
or