Error When Trying to Register Telerik in a User Control

3 posts, 1 answers
  1. Holly
    Holly avatar
    14 posts
    Member since:
    Feb 2012

    Posted 19 Apr 2012 Link to this post

    Hi!

                    While I was converting some regular ASP code to use the Telerik controls, I found a problem with some of our pages. We have a header user control with a logout button, so I want to convert the button to be a Rad Image Button. When I add in a RadButton (or Rad anything) to the header, I get an error that says “The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)for some of the pages. I found that it seems to be unhappy with the <%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> line, or anything that tries to add Telerik controls to the user control. Does anyone have any idea what could be causing this and how to fix it? I’d really like to be able to the Telerik image buttons throughout all of our code. Thanks!

                                    Holly

  2. Answer
    Jayesh Goyani
    Jayesh Goyani avatar
    2733 posts
    Member since:
    May 2010

    Posted 20 Apr 2012 Link to this post

    Hello Holly,

    Put your JS code in RadCodeBlock as shown in Below code snippet.
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <script type="text/javascript">
    .................
    ................
     </script>
     </telerik:RadCodeBlock>

    If you still get the also put property tag in Radcodeblock.

    <telerik:RadCodeBlock ID="RadCodeBlock2" runat="server">
    <%= GetCloseButtonTitle %>
     </telerik:RadCodeBlock>


    Note : Put your '<%# %>' type of tag/code in RadCodeBlock Tag.

    Thanks,
    Jayesh Goyani
  3. Holly
    Holly avatar
    14 posts
    Member since:
    Feb 2012

    Posted 20 Apr 2012 Link to this post

    Dear Jayesh,

               

                Thank you very much for your help! I just tried putting the RadCodeBlock around each of the script sections in the pages that didn’t want to load the header, and that seemed to do the trick! They’re all loading now. Thanks so much! Have a great day!

                           

                            Holly

Back to Top