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

what are prerequisits for Getting started

1 Answer 62 Views
Grid
This is a migrated thread and some comments may be shown as answers.
pradip
Top achievements
Rank 1
pradip asked on 03 Mar 2009, 08:40 PM
hi, I am just started working on Telerik Grid, but getting error  as copied below. Please suggest me what needs to be done to fix it... Am i missing anything? Thanks, Pradip

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

[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) +280
   Telerik.Web.UI.RadAjaxControl.PerformRender() +502
   Telerik.Web.UI.RadAjaxControl.OnPageRender(HtmlTextWriter writer, Control page) +1851
   Telerik.Web.UI.RadAjaxControl.RenderPageInAjaxMode(HtmlTextWriter writer, Control page) +163
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +149
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +80
   System.Web.UI.Control.Render(HtmlTextWriter writer) +39
   System.Web.UI.Page.Render(HtmlTextWriter writer) +49
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +81
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +336
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +64
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5898


Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 04 Mar 2009, 03:58 AM
Hello Pradip,

When you receive this exception you have to either move the javascript code block outside of the head tag as shown below:
// before 
<head runat="server"
   <script> 
   var controlClientObject = <%= RadControl1.ClientID %> 
   ... 
   </script> 
</head> 
 
<body> 
... 
</body> 
//after 
<head runat="server"
</head> 
<body> 
   <script> 
   var controlClientObject = <%= RadControl1.ClientID %> 
   ... 
   </script> 

or use a RadCodeBlock and RadScriptBlock.

Thanks
Princy.
Tags
Grid
Asked by
pradip
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or