Hi
I have a page with several input controls, combos and sliders with some javascript. Every thing works fine till I add an Ajax Panel. After that I got an error:
All my javascripts are below the Body section and not in the Header.
In the existing scripts I already try to replace <%= ...> with <%# ...> and I also try to replace for example '<%= ctr_txn6.ClientID %>' with '<%= String.Format("{0}", ctr_txn6.ClientID) %>', but all of these changes only work if I remove the Ajax Panel.
Thanks
I have a page with several input controls, combos and sliders with some javascript. Every thing works fine till I add an Ajax Panel. After that I got an error:
The Controls collection cannot be modified because the control contains
code blocks (i.e. <% ... %>).
The code from this Ajax Panel do not use any <% ...%>.
All my javascripts are below the Body section and not in the Header.
In the existing scripts I already try to replace <%= ...> with <%# ...> and I also try to replace for example '<%= ctr_txn6.ClientID %>' with '<%= String.Format("{0}", ctr_txn6.ClientID) %>', but all of these changes only work if I remove the Ajax Panel.
Thanks
7 Answers, 1 is accepted
0
Accepted
Hello Quim,
You could use RadCodeBlock in your application. The RadCodeBlock should be used when you have server code blocks placed within the markup (most often some JavaScript functions accessing server controls). It should prevents from the error you are facing. For more information on this control please review the following help topic.
Sincerely yours,
Maria Ilieva
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
You could use RadCodeBlock in your application. The RadCodeBlock should be used when you have server code blocks placed within the markup (most often some JavaScript functions accessing server controls). It should prevents from the error you are facing. For more information on this control please review the following help topic.
Sincerely yours,
Maria Ilieva
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0

Quim
Top achievements
Rank 1
answered on 04 Jul 2008, 05:38 PM
Thank you, it works
0

Gabriel
Top achievements
Rank 2
answered on 16 Oct 2012, 04:25 PM
Hello, that works well when you work with script blocks, but what happens with parameters for my html?
something like:
in advance, thanks
something like:
<
label
for="<%= myTextBox.ClientID %>" >Text</
label
>
<
asp:TextBox
id
=
"myTextBox"
runat="server />
in advance, thanks
0
Hello Gabriel,
You could still use RadCodeBlock in such cases by wrapping all the content on the page where server code is used.
Greetings,
Maria Ilieva
the Telerik team
You could still use RadCodeBlock in such cases by wrapping all the content on the page where server code is used.
Greetings,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0

Gabriel
Top achievements
Rank 2
answered on 19 Oct 2012, 02:11 PM
Really? I didn't know that!,
anyway, could you tell us why we are enforced to do that? I don't like to know only the "how to fix" I rather know the "why this happens".
anyway, could you tell us why we are enforced to do that? I don't like to know only the "how to fix" I rather know the "why this happens".
0
Hi Gabriel,
For more background on this issue see Understanding how <% %>expressions render and why Controls.Add() doesn't work.
Greetings,
Maria Ilieva
the Telerik team
For more background on this issue see Understanding how <% %>expressions render and why Controls.Add() doesn't work.
Greetings,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0

Gabriel
Top achievements
Rank 2
answered on 22 Oct 2012, 02:49 PM
Thanks Maria :D