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

[Solved] RadAjaxManager problem.

1 Answer 177 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Miklos
Top achievements
Rank 1
Miklos asked on 20 Jun 2008, 07:28 PM
Hi,

Here is the scenario I am having trouble with. I have a page with multiple RadAjaxPanels each with its own info. Each panel has a link which opens a RadWindow that contains a form. Once the user hits submit on this form the window closes and calls the OnClientCloseX() javascript function as per the HelpDesk example (muliple functions for each of the panels). Each of the panels have their own codebehind to handle the ajax request which would update their panel data. However the 

$find("<%= RadAjaxPanel1.ClientID %>").ajaxRequest(-1);

line causes the error shown on the bottom of the post. If I replace the line with

$find("ctl00_LeftPanel_RadAjaxPanel1").ajaxRequest(-1);

then the panel gets updated using Ajax correctly. This is the code that is generated by the ClientID request. What do I need to change to avoid the error and not have to enter the ID manually for all of the panels. The result is at the bottom of the post.


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) +2108094
Telerik.Web.UI.RadAjaxControl.MoveUpdatePanel(Control initiator, Control updated) +110
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

1 Answer, 1 is accepted

Sort by
0
Konstantin Petkov
Telerik team
answered on 23 Jun 2008, 07:53 AM
Hi Miklos,

You don't need to change the client ID. You can wrap the code in a RadCodeBlock to resolve the error. Please, take a look at this article for details.

All the best,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Ajax
Asked by
Miklos
Top achievements
Rank 1
Answers by
Konstantin Petkov
Telerik team
Share this question
or