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

Error When Trying to Register Telerik in a User Control

2 Answers 57 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Holly
Top achievements
Rank 1
Holly asked on 19 Apr 2012, 10:57 PM

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 Answers, 1 is accepted

Sort by
0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 20 Apr 2012, 02:07 PM
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
0
Holly
Top achievements
Rank 1
answered on 20 Apr 2012, 04:08 PM

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

Tags
General Discussions
Asked by
Holly
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Holly
Top achievements
Rank 1
Share this question
or