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

[Solved] No RadAjaxManager1 ???

2 Answers 116 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 21 Jul 2009, 12:42 PM
I am getting seriously confused (once again)...

My form is quite simple and has a RadAjaxManager called RadAjaxManager1

A javascript method called Initialise() is called on Body / Onload
That method is defined in a script block in the Head section.

At the end of that method, I try to call ajaxRequest() on my AjaxManager but every syntax I try fails in various ways...

            var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
            ajaxManager.ajaxRequest("ReloadGrid");

In this case ajaxManager is null, hence ajaxRequest does not work

            var ajaxManager = $find("<% = RadAjaxManager.GetCurrent(Page).ClientID % >");
 
This gives me the same null which is not surprising because it's translated to the same on the client side.

My code looks something like
<head runat="server"
  <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"
  <script language="javascript"
    function GetRadWindow() { 
... 
    } 
 
    function Initialise() { 
... 
       //var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>"); 
       var ajaxManager = $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>"); 
        
       ajaxManager.ajaxRequest("ReloadGrid"); 
     } 
  </script> 
  </telerik:RadCodeBlock> 
</head> 
<body onload="Initialise()"
  <form id="form1" runat="server"
  <div> 
    <div id="hideMe1" style="height: 0px; width: 0px; position: absolute; top: -100px;"
      <telerik:RadWindowManager ID="RadWindowManager1" runat="server" /> 
      <telerik:RadScriptManager ID="RadScriptManager1" runat="server" /> 
      <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
... 

Am I missing something fundamental?

Eric

PS: There is no master page or anything remotely complicated that I can think of... and I have other forms working fine with RadAjaxManager


2 Answers, 1 is accepted

Sort by
0
Accepted
Pavel
Telerik team
answered on 21 Jul 2009, 01:53 PM
Hello Eric,

Generally it is not recommended to use <body onload="MyFunction()"> with an ASP.NET AJAX page as explained in details in this blog post. If you want yo execute a script when the page is loaded you can create a function with the name pageLoad() which is a reserved name in the AJAX framework. Thus all controls will be initialized on the client when it is fired and the RadAjaxManager's client object should be properly accessed.

All the best,
Pavel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Eric
Top achievements
Rank 1
answered on 21 Jul 2009, 02:07 PM
Aahhhhh.....

This would explain that!


Many thanks

Tags
Ajax
Asked by
Eric
Top achievements
Rank 1
Answers by
Pavel
Telerik team
Eric
Top achievements
Rank 1
Share this question
or