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

[Solved] ajax error

5 Answers 219 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Stuart
Top achievements
Rank 1
Stuart asked on 28 Jan 2008, 02:15 PM
why cant i place the clientside ajax request in the form tags ?

        <telerik:RadAjaxLoadingPanel ID="ajaxLoader" runat="server" Height="75px" Width="75px" 
            Transparency="5">  
            <img alt="Loading..." src="RadControls/Ajax/Skins/Default/loading7.gif" 
                style="border: 0px;" /> 
        </telerik:RadAjaxLoadingPanel> 
        <script language="javascript" type="text/javascript">     
        function gotoPage(CallDesc)  
        {             
                var ajax = <%= ajaxMan.ClientID %>;  
                ajax.AjaxRequest(CallDesc);  
                       
        }        
    </script> 
          
    </form> 
why does the The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).  error occur?

i know if you replace the <%=  with <%# the code runs but does not return the control id;

now if i put this outside of the form block an call the gotoPage() method in the bofy tag  <body onload="gotoPage('ActivateJavasciptLayer')"> ; it says that object or method not supported (refering to AjaxRequest), but if the page completely load then if i call this method it works ? this problem occured after upgraded to the latest Q3 2007 version.

If you could mabe provide a workaround i would greatly appriciate it
thank you

5 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 29 Jan 2008, 08:00 AM
Hello Stuart,

Actually we were not able to reproduce the problem and the "The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).  error" occurs in the exactly oposite circumstances - i.e. have the code in the <head> tag. Make sure that you do not have codeblocks in your head tag and see if that resolves the problem. If it does not, can you try to isolate a simple runnable page replicating this, so we can investigate on our end?

Looking forward to your reply.

Regards,
Steve
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Steve
Telerik team
answered on 29 Jan 2008, 12:05 PM
Hello Stuart,

Just a quick follow up, as I noticed that you are using the Prometheus RadAjax. To avoid the error, please wrap your scripts in the new RadCodeBlock or RadScriptBlock controls. Here is an example:

<telerik:RadScriptBlock ID="cb1" runat="server">
 <script language="javascript" type="text/javascript">    
        function gotoPage(CallDesc) 
        {            
                var ajax = <%= ajaxMan.ClientID %>; 
                ajax.AjaxRequest(CallDesc); 
                      
        }       
 </script>
</telerik:RadScriptBlock>

These are two new controls, which are not yet documented (will be in the SP2 release). RadCodeBlock is a control that is used to wrap code blocks in your aspx, which will normally throw the famous "Controls collection cannot be modified ..." error when MS AJAX is present on the page.

RadScriptBlock is a new control similar to RadCodeBlock and you can use it to execute scripts blocks inside the updating areas.

Best wishes,
Steve
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Stuart
Top achievements
Rank 1
answered on 02 Feb 2008, 09:45 AM
Hi

When can I expect this script block to be released ?
0
Giuseppe
Telerik team
answered on 04 Feb 2008, 08:20 AM
Hi Stuart,

These controls are already part of the Prometheus suite -- what my colleague Steve meant is that they will be properly documented for the service pack release in two weeks but you can safely use them now as well. 


Sincerely yours,
Manuel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Stuart
Top achievements
Rank 1
answered on 04 Feb 2008, 11:19 AM
O thank you, was actually worried there for a second
Tags
Ajax
Asked by
Stuart
Top achievements
Rank 1
Answers by
Steve
Telerik team
Stuart
Top achievements
Rank 1
Giuseppe
Telerik team
Share this question
or