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

4 Answers 511 Views
UI for ASP.NET AJAX in ASP.NET MVC
This is a migrated thread and some comments may be shown as answers.
Brian Mains
Top achievements
Rank 1
Brian Mains asked on 16 Oct 2009, 03:48 PM
hello,

I have two date/time pickers within the site details page.  It was working fine, but now I'm getting the error in my MVC view as shown below.  Again,  this is in a view and I have a RadScriptManager defined within the Site.Master master page.

Thanks.

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

[HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).]
   System.Web.UI.ControlCollection.Add(Control child) +8677431
   Telerik.Web.SkinRegistrar.RegisterCssReference(Page _page, Control _control, String _url) +257

[HttpException (0x80004005): Please, see whether wrapping the code block, generating the exception, within RadCodeBlock resolves the error.]
   Telerik.Web.SkinRegistrar.RegisterCssReference(Page _page, Control _control, String _url) +305
   Telerik.Web.SkinRegistrar.RegisterCssReferences(ISkinnableControl _control) +435
   Telerik.Web.UI.RadWebControl.RegisterCssReferences() +51
   Telerik.Web.UI.RadWebControl.OnPreRender(EventArgs e) +53
   Telerik.Web.UI.RadInputControl.OnPreRender(EventArgs e) +12
   Telerik.Web.UI.RadDateInput.OnPreRender(EventArgs e) +288
   Telerik.Web.UI.DatePickingInput.OnPreRender(EventArgs e) +238
   System.Web.UI.Control.PreRenderRecursiveInternal() +80
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842

It was working, but now I don't know why I'm getting the error?


4 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 18 Oct 2009, 09:15 AM
Hi Brian,

Try wrapping your client-code into a RadCodeBlock or RadScriptBlock control and see if it makes any difference.

Kind regards,
Iana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Brian Mains
Top achievements
Rank 1
answered on 29 Oct 2009, 09:15 PM
Hello,

This wasn't JavaScript code; it was the actual RadComboBox itself; I didn't have any code (just used UI components).  So is there another option, or is there a reason for this happening?

Thanks.
0
Georgi Krustev
Telerik team
answered on 04 Nov 2009, 12:24 PM
Hi Brian Mains,

Review the attached test project which shows how to render RadDatePicker.

Greetings,
Georgi Krustev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Scott Rakestraw
Top achievements
Rank 1
answered on 08 Dec 2009, 02:46 AM
Would you use the same approach for a TreeView control?
Tags
UI for ASP.NET AJAX in ASP.NET MVC
Asked by
Brian Mains
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Brian Mains
Top achievements
Rank 1
Georgi Krustev
Telerik team
Scott Rakestraw
Top achievements
Rank 1
Share this question
or