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

Thread is closed for posting
5 posts, 0 answers
  1. Brian Mains
    Brian Mains avatar
    485 posts
    Member since:
    Oct 2008

    Posted 16 Oct 2009 Link to this post

    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?


  2. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 18 Oct 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Brian Mains
    Brian Mains avatar
    485 posts
    Member since:
    Oct 2008

    Posted 29 Oct 2009 Link to this post

    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.
  5. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 04 Nov 2009 Link to this post

    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.
  6. Scott Rakestraw
    Scott Rakestraw avatar
    84 posts
    Member since:
    Sep 2005

    Posted 07 Dec 2009 Link to this post

    Would you use the same approach for a TreeView control?
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017