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

find Rad ajax manager returns null

7 Answers 340 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Gokul Gokul
Top achievements
Rank 2
Gokul Gokul asked on 29 Dec 2010, 04:39 AM
Hi there,
            $find("RadAjaxManager1") returns null particularly when call from modal pop up button click. but while call from page controls events it works. Thanks in advance

7 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 29 Dec 2010, 06:59 AM
Hello Gokul,

I am not quite sure about your scenario. In normal scenario your code will work fine. In complex scenarios like masterpage,user control, a better approach is to use the "ClientID" with server tag.

Clientside:
var ajax = $find('<%=AjaxMgr.ClientID%>');

Please go through this documentation for more on RadAjaxManager Client object.

Regards,
Shinu.
0
Gokul Gokul
Top achievements
Rank 2
answered on 29 Dec 2010, 07:08 AM
Hi Shinu,
             I found the problem and rectify it. the solution is rad ajax manager can only be found at updated controls event fires. the other control events which is not in updated controls list returns null while $find("RadAjaxManager1").

Thanks for your reply...
0
Dave
Top achievements
Rank 1
answered on 06 Mar 2012, 07:03 PM
Gokul,

What was your solution to finding your RadAjaxManager instance using client-side code after being called from a modal pop up button click? I am running into the same problem you had. I use the $find method on the RadAjaxManager instance but it comes back null.

Thanks,
Dave
0
Antonio Stoilkov
Telerik team
answered on 09 Mar 2012, 12:16 PM
Hello Dave,

Based on your description is hard to determine what is causing the issue. You could try accessing the RadAjaxManager on the page by following the code shown below. Note that wrapping the JavaScript code in RadScriptBlock is required.
<telerik:RadScriptBlock runat="server">
    <script type="text/javascript">
        var ajaxManager;
        function pageLoad()
        {
            ajaxManager = $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>");               
        }
    </script>
</telerik:RadScriptBlock>

Greetings,
Antonio Stoilkov
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
Lohith
Top achievements
Rank 1
answered on 08 Nov 2012, 06:17 AM
I too was facing the issue. I had not OnclientClose method declare for windowsmanager but had not declared it. I was ignoring it. but other script that was trying to find the ctrl was also failing after that.  Though I did see the control in the DOM hierachy. 
0
Daniel
Top achievements
Rank 1
answered on 03 Jan 2013, 09:51 AM
I faced the same problem with Chrome and Firefox (works in IE).
The $find("radAjaxManager") works sometimes for the first event, but returns null on subsequent events.
The fix is to fallback to DOM if $find fails:

<telerik:RadCodeBlock runat="server">
   var ajaxManager = $find("<%=radAjaxManager.ClientID%>");
   if(!ajaxManager) ajaxManager = window.<%=radAjaxManager.ClientID%>;
   ajaxManager.ajaxRequestWithTarget("<%=myControl.UniqueID %>", "");
</telerik:RadCodeBlock>

0
Vincy
Top achievements
Rank 1
answered on 08 Aug 2013, 07:55 AM
Thanks
Tags
Ajax
Asked by
Gokul Gokul
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Gokul Gokul
Top achievements
Rank 2
Dave
Top achievements
Rank 1
Antonio Stoilkov
Telerik team
Lohith
Top achievements
Rank 1
Daniel
Top achievements
Rank 1
Vincy
Top achievements
Rank 1
Share this question
or